UG-1042 and KE-2088 match. Group 1 contains UG or KE, and group 2 contains the corresponding digits. Reported indexes are zero-based.
DATA & TEXT · FREE JAVASCRIPT TOOL
JavaScript Regular Expression Tester
Test JavaScript regular expressions, flags, matches, groups and positions against sample text.
Ready in your browser
Your processed result will appear here.
A WORKED TASK
Inspect order-code matches and capture groups
Use the pattern ([A-Z]{2})-(\d+) with the g flag against the two order lines. The complete match includes the hyphen; the parentheses expose the two-letter prefix and numeric part independently. Add a lowercase code to see how the result changes when you add the i flag.
This uses JavaScript RegExp, not Python or PCRE. Positions use JavaScript string indexes, which can differ from visible character counts for emoji. Avoid untrusted patterns and large text.
What to check
- Paste the pattern without surrounding / characters; enter flags in their separate field.
- A valid expression with no matches is different from an invalid expression.
- Use small inputs. Nested repetition can be extremely expensive even for an expression that is syntactically valid.
TESTED & REVIEWED
Know what this tool does—and where to double-check
- Reviewed by
- HTML Online Viewer project
- Last reviewed
- Processing
- Ordinary processing happens in this browser tab; the tool does not intentionally upload your source.
- Important limitation
- JavaScript checks and transformations cannot prove that application logic is correct. Test the result in its real project before publishing.
PRACTICAL EXAMPLE
Start with a small JS Regex Tester example
The built-in sample makes the accepted input visible before you use your own project data.Example input
Order UG-1042 costs 45000 UGX.
Order KE-2088 costs 72000 KES.Run the sample first, then change one value at a time so each result remains easy to explain.
What this example demonstrates
Test JavaScript regular expressions, flags, matches, groups and positions against sample text.
Keep the original file, review the generated result and test production code in its real application before publishing.
COMMON QUESTIONS
JS Regex Tester FAQ
Is JS Regex Tester free?
Yes. It is free to use and requires no account.
Does JS Regex Tester upload my source?
No. Ordinary processing happens locally in the current browser. The JavaScript runner uses a short-lived isolated browser worker.
Can I import and export a file with JS Regex Tester?
Yes. Import a relevant JavaScript, JSON or text file, then save the input or processed result.