Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

match ascii characters except few characters

I have a regexp that matches all ascii characters:

/^[\x00-\x7F]*$/

Now I need to exclude from this range the following characters: ', ". How do I do that?

like image 747
Max Koretskyi Avatar asked Feb 16 '16 08:02

Max Koretskyi


1 Answers

You can use negative lookahead for disallowed chars:

/^((?!['"])[\x00-\x7F])*$/

RegEx Demo

(?!['"]) is negative lookahead to disallow single/double quotes in your input.

like image 105
anubhava Avatar answered Sep 27 '22 20:09

anubhava