3
I currently have the following regex:
"/([^\w\.\,]+\s*)/"
It escapes, letters, numbers, commas and dots followed or not by space. How do I let it escape everything except the characters: <
>
=
!
3
I currently have the following regex:
"/([^\w\.\,]+\s*)/"
It escapes, letters, numbers, commas and dots followed or not by space. How do I let it escape everything except the characters: <
>
=
!
5
Try this, it will make him accept only the characters <
>
!
=
:
/[<>=!]/g
Example: https://regex101.com/r/eF5pG8/1
Already this will make him accept everything except the characters <
>
!
=
:
/[^<>=!]/g
Example: https://regex101.com/r/eF5pG8/3
It worked, so too (which I did according to your previous answer) [(<|>|=|!)]
.
Parentheses and |
inside brackets are taken literally, not as special syntax. This regex also does not accept (
, |
nor )
. If you want to deny a character set, simply do /[^<>=!]/g
. P.S. And the comment of @Leonardovilarinho accepts (
, |
and )
when you shouldn’t accept.
@mgibsonbr, you have prayer, had not attacked me to it. I will edit the answer with your suggestion. Thank you.
Browser other questions tagged regex
You are not signed in. Login or sign up in order to post.
You want to marry only the characters
< > = !
that?– gato
Yes, only those characters, whether or not followed by space
– Leonardo