Skip to content Skip to sidebar Skip to footer

Javascript Regular Expression Not Matching

Morning All I have a javascript regular expression that doesn't work correctly and I'm not sure why. I'm calling the API at https://uptimerobot.com, and getting back a JSON string

Solution 1:

Escape all the backslashes one more time because within " delimiters, you must escape the backslash one more time or otherwise it would be treated as an escape sequence.

var regEx = new RegExp("^[a-zA-Z]+\\(\\{.*\\}\\)$", "m");

DEMO

Post a Comment for "Javascript Regular Expression Not Matching"