Regex to escape data to be displayed inside of `::before`


Regex to escape data to be displayed inside of `::before`
Characters I need to escape: / " spaces ? $ # * + ? ( ) [ ] white space
using this right now: props.text.replace(/[-[]()*+?.,\/^$|#s]/g, '\$&');
props.text.replace(/[-[]()*+?.,\/^$|#s]/g, '\$&');
But the above doesn't escape double quotes.
1 Answer
1
Characters I need to escape / " spaces ? $ # * + ? ( ) [ ] white space
Characters I need to escape / " spaces ? $ # * + ? ( ) [ ] white space
That would be this regex /[/\"s?$#*+?()[]]/
/[/\"s?$#*+?()[]]/
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Comments
Post a Comment