JavaScript Regular Expression: Non-Digit Character

后端 未结 1 2036
渐次进展
渐次进展 2020-12-16 09:27

How do I say remove a number preceded by a non-digit and followed by a dash, but leave the preceding non-digit character?

RegExp: /[^\\D]4\\-/
String: http:/         


        
相关标签:
1条回答
  • 2020-12-16 09:48

    You want [\D] or [^\d], but not [^\D]. Regex is case-sensitive, \d matches a digit, and \D matches anything but a digit.

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