Regex Error: Nothing to Repeat

前端 未结 3 919
北海茫月
北海茫月 2021-01-26 08:50

I\'m new to regular expressions in JavaScript, and I cannot get a regex to work. The error is:

Uncaught SyntaxError: Invalid regular expression: /(.

3条回答
  •  春和景丽
    2021-01-26 09:25

    Javascript regular expressions don't support possessive quantifiers. You should try with the reluctant (non-greedy) ones: *? or +?

提交回复
热议问题