search

Home  >  Q&A  >  body text

javascript - Regular expression /(\d)(?=(\d{3})+\.)/gIf ?= is changed to ?: Why are the results different?

I remember? :and? =Almost the same, but? : capture while? =Do not capture

高洛峰高洛峰2816 days ago348

reply all(2)I'll reply

  • 黄舟

    黄舟2017-05-19 10:37:15

    I don’t know what your needs are. Judging from the title alone, there is not much difference

    ?=is positive lookahead ?:is not capturing

    reply
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-19 10:37:15

    If you check whether it matches, then it will definitely return true, but if you take Full match, the two are different.

    To understand the meaning of Lookahead, it matches a position, not the real character

    Recommend a website for testing regex
    https://regex101.com

    Use the two regular expressions and 1333 tests you provided to separate the results

    reply
    0
  • Cancelreply