I have a string that I need to replace in a document. The tricky part is that the text must match but the spaces can be new lines. So I have
var myString = 'a b c'
and need to match instances like 'a b c'
and 'a\nb c'
.
I think /a\sb\sc/
is the expression I want, but am not sure how to turn the original string into that expression.
I've tried RegExp(myString.replace(/ /g, '\s'))
which gives me /asbsc/
.
Please show me how I can turn the given string into the correct regular expression.