Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
^yahoo\.com?(?:(?!\.[a-z]{2}).)*(?:.com?)?$
/
gmi

Description

This pattern will match everything directly below your yahoo REPLACE section and non of the good cases above: ^yahoo.com?(?:(?!.[a-z]{2}).)*(?:.com?)?$

IE you do not want to include yahoo.fr or yahoo.com.fr or yahoo.co.uk

Submitted by anonymous - 7 years ago