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

后端 未结 6 936
悲&欢浪女
悲&欢浪女 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:01

    You're probably seeing it in this context

    (?:...)
    

    It means that the group won't be captured or used for back-references.

    EDIT: To reflect your modified question:

    (?:^|....)
    

    means "match the beginning of the line or match ..." but don't capture the group or use it for back-references.

提交回复
热议问题