Regular Expressions 101

Community Patterns

Match only first occurrence of word in a line.

2

Regular Expression
PCRE (PHP <7.3)

/
^(.*?)\bdefault\b
/
gm

Description

Match only first occurrence of word in a line.

Submitted by Vivek Shah - 8 years ago