Regular Expressions 101

Community Patterns

Search string with simple * wildcarding at beginning and end allowed

0

Regular Expression
PCRE (PHP <7.3)

/
\A(?# String begin)([\*])?(?# Optional * at begin)([[:word:][:blank:][!"#$%£¥#%@€&'()+,\-.\/:;<=>?@[\]^_`{|}~§üäöÜÄÖ]]*)(?# match characters allowed as search string - no * in here!){3,}?(?# at least 3 characters, non greedy)([\*])?(?# optional * at end)\Z(?# end of string)
/
g

Description

Search string which allows wildcard (*) at beginning and or end, but not in between. Search string itself allows almost any character but *

Submitted by Tom42 - 7 years ago