What does ?= mean in a regular expression?

前端 未结 4 1359
一向
一向 2020-11-29 20:21

May I know what ?= means in a regular expression? For example, what is its significance in this expression:

(?=.*\\d).
4条回答
  •  遥遥无期
    2020-11-29 21:05

    The below expression will find the last number set in a filename before its extension (excluding dot (.)).

    '\d+(?=\.\w+$)'
    

    file4.txt will match 4.

    file123.txt will match 123.

    demo.3.js will match 3 and so on.

提交回复
热议问题