Matches for UG-1042 and KE-2088. Each has a full match, two capture groups and its position in the input.
CHECK CODE · FREE PYTHON TOOL
Python Regular Expression Tester
Test Python-style regular expressions against text and inspect full matches, capture groups and positions using the browser Python runtime.
Python runtime preparing…
Your result will appear here.
A WORKED TASK
Capture order codes with Python regular expressions
The sample pattern ([A-Z]{2})-(\d+) matches an uppercase two-letter code followed by a hyphen and digits. Test it against the two order lines. The parentheses make separate capture groups, so you can inspect the country-style prefix independently of the number.
The Python re engine and JavaScript RegExp differ. A successful test is not proof that a pattern is safe or fast for arbitrary production input. Stop an expensive runtime job if necessary.
What to check
- Enter the pattern itself, not surrounding /slashes/ from a JavaScript example.
- An invalid expression is different from a valid expression that finds no matches.
- Start with a short test string and add edge cases such as lowercase letters or a missing hyphen.
TESTED & REVIEWED
Know what this tool does—and where to double-check
- Reviewed by
- HTML Online Viewer project
- Last reviewed
- Processing
- Code and supported files are processed in this browser tab. Runtime tools download Python WebAssembly, but do not intentionally upload your source.
- Important limitation
- The browser runtime is intentionally isolated and may not include every desktop package, system command or network feature. Verify production programs in their target Python environment.
EXAMPLE INPUT
Start small, then use your own data
Test text
Order UG-1042 costs 45000 UGX.
Order KE-2088 costs 72000 KES.Matches for UG-1042 and KE-2088. Each has a full match, two capture groups and its position in the input.
COMMON QUESTIONS
Python Regex Tester FAQ
Does this upload my code or files?
No. Processing happens locally in your browser. Runtime tools download Python itself, but your source is not sent to our server.
Why can the first Python run take longer?
The browser downloads and starts the Python WebAssembly runtime. Later runs in the same tab are normally much faster.
Can I stop a program that takes too long?
Yes. Runtime tools show a Stop button while Python is working. Stopping terminates the isolated worker and a clean runtime starts when needed.