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

后端 未结 7 1093
臣服心动
臣服心动 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:55

    • . means "any character".
    • * means "any number of this".
    • .* therefore means an arbitrary string of arbitrary length.
    • ^ indicates the beginning of the string.
    • $ indicates the end of the string.

    The regular expression says: There may be any number of characters between the expression (?=.{8,})(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&+=]) and the beginning and end of the string that is searched.

提交回复
热议问题