What is a regular expression?
A regular expression is a small pattern language for describing shapes of text. Instead of searching for one fixed string, you describe what you are looking for — three digits, then a hyphen, then four digits — and the engine finds every piece of text that fits.
The pattern is built from ordinary characters that match themselves, plus a handful of characters with special meaning. a matches the letter a. \d matches any digit. +means “one or more of the thing before me”. Put together:
[A-Z]{1,2}\d[A-Z\d]?\s?\d[A-Z]{2}Regular expressions are supported almost everywhere — JavaScript, Python, Go, Java, grep, your editor’s find box — with small differences in syntax between them. This tester uses the JavaScript flavour, which is what runs in browsers and Node.js.
They are excellent at finding and extracting patterns in flat text, and genuinely bad at anything that nests. A regular expression cannot count how deeply brackets are nested, which is why they cannot parse HTML or JSON no matter how clever the pattern gets. Use something that parses instead — the HTML formatter builds a real document tree, and a JSONPath tester queries JSON by its structure rather than by the shape of its text.