Regex to match a word with + (plus) signs

后端 未结 5 1474
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-04 01:46

I\'ve spent some time, but still have to solution. I need regular expression that is able to match a words with signs in it (like c++) in string.

I\'ve used /\

5条回答
  •  天命终不由人
    2020-12-04 02:12

    + is a special character so you need to escape it

    \bC\+\+(?!\w)
    

    Note that we can't use \b because + is not a word-character.

提交回复
热议问题