Why does this works:
'ye+low'.replace(/\+/g, 'l')
// > yellow
but this does NOT work:
'ye\low'.replace(/\\/g, 'l')
// > yelow
??
I need to replace ONE backslash with something, but I can't seem to make it happen.
NOTE: I CAN'T change the string as it comes in a variable.
EDIT: I understand \
is an escape character in javascript. This is fine with my understanding and I read plenty of other SO answers in this regard. My question is: "Ok I know, but still: HOW DO I REPLACE ye\low
to be yellow
using javascript?" I understand regex may not be the way to go because of its interpretation of backslashes, but I bet there is some way to get the desired output i some fashion.