Regex Lab: test a text pattern
Optional support demo · 3–5 minutes · choose one example. Return to your own project's literature claim and evidence after this check.
A regular expression (regex) describes a pattern in characters. Use it to find terms, check filenames or extract a labelled field. It does not understand a design claim, judge a paper, or work like a semantic search engine.
Illustrative text, not research data. These small examples are authored for this exercise. The DOI example uses a real paper identifier solely to demonstrate a field format; it is not a ScienceDirect export.
1. Predict, then run
Editable. Maximum 200 characters. Backslashes are typed once here: \b, not \\b.
i: ignore case. m: ^/$ mark line boundaries. u: Unicode mode. g: enumerate matches; this lab adds it automatically. Only i m g u, each at most once, are allowed.
Maximum 5,000 characters. Before running, identify one expected match and one item that should not match.
Changing inputs does not execute a pattern. Results use your browser’s JavaScript regex engine; other search tools may use different syntax.
2. Inspect what matched
Load an example, predict the matches, then select Run pattern.
Matched text
Yellow marks show matched characters. A zero-length match has no characters to highlight; its position is listed below. Positions count UTF-16 code units from 0.
Matches and capture groups
Parentheses capture parts of a match. The DOI example stores the field value in group 1. Unmatched optional groups are labelled explicitly.
| Match / position | Full match | Capture groups |
|---|
3. Judge the pattern against your purpose
- False positive: an unwanted item matches.
\bpassive\bmatches “not passive”; matching the word does not establish a passive-design claim. - False negative: a relevant item is missed. The shade pattern misses “overhang” and “shaded”, even when either could matter to your design question.
- Revise and recheck: edit one term, filename or field. Predict the effect, run again, and record the expected versus observed result and one remaining limitation on the clinic card.
Boundary symbols and groups control text matching, not meaning. The filename example checks a naming rule, not whether the file exists or contains valid data. The DOI example extracts a field value; it does not validate the identifier or the research.
DOI format demonstration: Mora & Bardhan (2025), Towards carbon neutrality: mapping mass retrofit opportunities in Cambridge, UK, 10.1098/rsos.241337. The example formats published citation metadata for a field-extraction exercise; it is not a database export.