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
/
.*?q=(.*)(-*)
/
gm
Input 1
1
New
http://example.com/mobile/?q=search-words http://example.com/?q=search-words2 http://example.com/mobile/?q=searchwords3&f=7&p=14&start=20
Substitution
/?s=$1
http://example.com/mobile/?q=search-words http://example.com/?q=search-words2 http://example.com/mobile/?q=searchwords3&f=7&p=14&start=20