I am using the Text String cdblt31.funtimes.com and DO NOT want to include "cdbltl31" in my Regex. How do I not capture that part?
>Solution :
This pattern will match all except the part you don’t want.
\.\w+\.\w+$
- First is a point which we have to escape as
\.because it has a special meaning in regex. - Then
\wmatches any word character (basically letters and numbers). +means one or more times ie. any number of repeats (except 0).- We then re-use the same symbols
\.\w+because we want to match a second point and more word characters. - Finally
$means the end of the line.
We could also write
(\.\w+){2}$
I’ll let you look up the new characters.