I am taking user generated strings and matching/replacing them as needed. Something to the tune of
new RegExp(str,'gi')
If a user types in something like [Hey
or ]
or something that would otherwise normally need to be escaped the code breaks. How can I work around this? is there a clean means of doing it?