Remove decimal point when not between two digits

前端 未结 3 1285
太阳男子
太阳男子 2021-01-05 02:55

I\'m cleaning up a search string and need to remove any periods that appear but keep decimal points when they are between two digits.

For example if I have a strin

3条回答
  •  有刺的猬
    2021-01-05 03:47

    You should take advantage of the lookahead and lookbehind assertions. They don't actually match characters in your input, but only determine whether a match is possible or not.
    You can use negative lookaheads and negative lookbehinds to do the opposite of this, which is what's appropriate here. Using the following for strRegEx will match periods that are not surrounded by digits:

    (?

提交回复
热议问题