Regexp Resulting Different Matches When Run From Js File And Chrome Console
This is weird, I have this statement in js code: alert ( 'Hello @name , your account will be activated at @date'.match(/@{1}[\w_]+/g) ); When I run the code from the file (openin
Solution 1:
As I tried to mention on the updatethe problem was the @ character was missing when inspecting it using chrome developer tool ( Thanks @Lee Kowalkowski for the insight).
I tried escaping it but still did not work.
Here is the solution I came up with:
var pattern = newRegExp(String.fromCharCode(64)+"{1}[\\w_]+","g"); //64 is ascii value of @
Still eager to know why @ character was missing
Post a Comment for "Regexp Resulting Different Matches When Run From Js File And Chrome Console"