Regular Expressions 101

Community Patterns

Regex Formula for matching 2 letter Prefix URL's

1

Regular Expression
PCRE (PHP <7.3)

/
^[a-z]{2}.sporttu.com
/

Description

I am trying to write a Regex formula that will match to all URL's with specifically 2 letter prefixes.

I have a list of close to 1000 websites, and I need a formula that will collect data from any sites that start with "..".sporttu.com. For example, I want it to match to sites like ca.sporttu and mx.sporttu but not sites like commonwealthgames.sporttu or x.sporttu.com.

So far I've got "^[a-z]{2}.sporttu.com". It matches to some 2 letter sites, but not even close to all of them and matches to no sites with +2 letters in the prefix. Any help would be much appreciated.

Submitted by MikeRo - 10 years ago