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
/
^(?!.*[^a-zA-Z0-9\s][^a-zA-Z0-9\s])(?!.*(?:^| )[^a-zA-Z0-9\s](?!\S))\S+(?: \S+)*$
/
gm
Input 1
1
New
# #A A# A2 3A test 4a test #A test test 4a test # test test# #_ *test < > <_ __ a_ a_ __ aa
Substitution
# #A A# A2 3A test 4a test #A test test 4a test # test test# #_ *test < > <_ __ a_ a_ __ aa