Please enable JavaScript to use regex101
/
^
r
e
g
e
x
[
\
-
_
]
?
1
0
1
$
/
i
Reg
ular
Ex
pressions
101
Upgrade to Pro
Enterprise
Regular Expression
/
(?:\buser1\b)?(.+?)(?:\buser1\b|$)
/
gm
Input 1
1
New
I don't get how to create a regular expression that matches everything, except a fixed, single word. Can somebody help me? Background: alias map for mailserver which redirects all mail to one user. /.*/ -> user1 produces a redirection loop, so i need to exclude user1 from the regexp. Edit: The regex should match everything, EXCEPT the single word user1. It should also match input that contains that word, i.e., user11.
Substitution