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
/
(?:(?P<inverted>\!) )?(?P<names>\-{1,2}\S+)($| (?P<values>.+(?=(?: [\!|\-])|$)))
/
gU
Input 1
New
-a val1 ! -b val2 --custom "string with crazy -a --test stuff inside" --param-with-dash val1 val2 -c ! -d ! --test
Substitution
-a val1 ! -b val2 --custom "string with crazy -a --test stuff inside" --param-with-dash val1 val2 -c ! -d ! --test