What are ^.* and .*$ in regular expressions?

后端 未结 7 1098
臣服心动
臣服心动 2021-02-03 23:05

Can someone explain the meaning of these characters. I\'ve looked them up but I don\'t seem to get it.

The whole regular expression is:

/^.*(?=.{8,})(?=.         


        
7条回答
  •  迷失自我
    2021-02-03 23:43

    Something else that my help you in the future:

    .*$
    

    will match two times given this string : "1"

    If you are wondering why, it's because it consumes all characters, but then also matches nothing. So the empty string is also a match.

提交回复
热议问题