What does the “?:^” regular expression mean?

后端 未结 6 920
悲&欢浪女
悲&欢浪女 2021-02-01 08:39

I am looking at this sub-expression (this is in JavaScript):

(?:^|.....)

I know that ? means \"zero or one times\" when it fol

6条回答
  •  情歌与酒
    2021-02-01 09:21

    (?:some stuff) means that you don't want to match the expression in the parentheses separately. Normally the pieces of a regexp grouped in parentheses are grouped and can be referenced individually (this is called using backreferences).

    See http://www.regular-expressions.info/brackets.html

提交回复
热议问题