【问题标题】:Regexp. How to match word isn't followed and preceded by another characters正则表达式。如何匹配单词后面和前面没有其他字符
【发布时间】:2017-07-26 21:51:24
【问题描述】:

I want to replace mm units to cm units in my code. In the case of the big amount of such replacements I use regexp.

I made such expression:

(?!a-zA-Z)mm(?!a-zA-Z)

But it still matches words like summa, gamma and dummy.

How to make up regexp correctly?

  • Is there a benefit to using lookahead/lookbehind instead of something like \\b[0-9+]\\s?mm\\b?

标签: regex


【解决方案1】:
【解决方案2】:
猜你喜欢
  • 1970-01-01
  • 2017-10-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多