In JavaScript, how do you use use the backtick (`) in a regular expression?
Sample code:
xtype: 'textfield',
regex: /^[a-zA-Z0-9àâçéèêîïôùû-.,:+*'()=&_ \s\u0060]+$/
backtick has no special meaning. you can use it as /`/
, it will work fine.
Use unicode character searches and it should do it. Unicode character code for backtick is \u0060
So /\u0060/
should find you backticks. Tested it on RegexPal and it works.
However, as previous respondent correctly said, ` should just work fine without escaping. You must have the problem somewhere else if it doesn't. But using the unicode will ensure that it will definitely match.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With