Javascript Regular Expression not matching

前端 未结 1 1701
半阙折子戏
半阙折子戏 2020-12-12 02:58

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 g

1条回答
  •  温柔的废话
    2020-12-12 03:24

    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

    0 讨论(0)
提交回复
热议问题