Regex library
Regular expression for hexadecimal strings
Match hex strings with an optional 0x prefix. Useful for color tokens without #, memory dumps, and Ethereum-style values.
^(?:0x)?[0-9A-Fa-f]+$
Runs 100% in your browser. Nothing you paste is uploaded, stored, or sent to a server.
Highlighted matches
How to use
- Scan the pre-filled pattern and the sample. Hits are highlighted; misses stay plain.
- Toggle flags if you need global or case-insensitive matching. The pattern is JavaScript / ECMAScript.
- Paste your own corpus. Nothing is sent to a server.
- Read the notes below before you drop the pattern into production — several of these are intentionally incomplete.
Hex shows up as 0x-prefixed literals, as raw dumps, and as IDs. This pattern accepts both the prefix and the bare form, and it rejects G and other non-hex letters.
123 matches because decimal digits are hex digits. If you need to require at least one A–F, tighten the pattern.
What this pattern will not do
Empty string fails.
Whitespace inside the digits fails; strip spaces from dumps first.
FAQ
How do I require an even number of digits?
^(?:0x)?(?:[0-9A-Fa-f]{2})+$
Is 0x optional on purpose?
Yes. Many checksums are published without a prefix.
Is the sample text uploaded?
No. The tester compiles the pattern with the browser’s RegExp engine and stays on the device.