Home / Guides / Regex search for website source code
Guide · Regex
Regex search for website source code
By SearchWebCode · Updated November 7, 2026 · Regex · 2 min read
/pattern/ when part of a source string varies. For example, /UA-[0-9]{4,}-[0-9]+/ matches legacy Analytics IDs with different account and property numbers.Regex is useful for an ID format or versioned filename. If you already know the complete value, search it as a literal instead: there is less to escape and fewer ways to match the wrong text.
Copy a pattern and check its matches
- Legacy Analytics IDs:
/UA-[0-9]{4,}-[0-9]+/. The final+allows property numbers with more than one digit. - One legacy Analytics account:
/UA-123456-[0-9]+/. Replace the account number with the one you are investigating. - AdSense publisher IDs:
/ca-pub-[0-9]{10,}/. This finds the identifier's format; check its surrounding tag before treating it as an account reference. - Versioned jQuery filenames:
/jquery-3\.[0-9]+\.[0-9]+/. This finds 3.x version strings in filenames, but misses copies bundled under another name.
Open several results, including one you did not expect. A code sample in a blog post can satisfy the same pattern as an installed tag.
Keep a fixed part in the pattern
The search engine uses literal fragments to narrow candidates before checking the full regex. Prefixes such as UA-, ca-pub- and jquery-3 give it something specific to find. A broad pattern such as [0-9]+ offers little help and can match almost any page.
Test the fixed fragment first, then add the variable part. If the literal search has no useful matches, a more complicated pattern is unlikely to solve the problem.
Combine a pattern with another term
A regex term can be part of a boolean query. For example, "wp-content" /UA-[0-9]{4,}-[0-9]+/ requires a WordPress reference and a legacy Analytics ID. See query syntax for the full operator rules.
The source-search basics cover literal queries. The Analytics lookup guide covers investigating one ID. For library versions, the jQuery report explains why a filename count is not a complete inventory of deployed versions.
Source counts checked 2026-10-14. They describe stored homepages, not live installations. How the counts are measured.
← All guides · Browse technologies · Search and export pricing
Frequently asked questions
Why are the dots in jquery-3\. escaped?
An unescaped dot matches any character in a regular expression. Escaping it requires a literal dot in the filename.
Why does my regex return unrelated pages?
The pattern may match numbers or text outside the tag you intended. Add a distinctive literal fragment, inspect the surrounding source and narrow the query only after seeing the false positives.