What does (?: do in a regular expression

后端 未结 4 972
天涯浪人
天涯浪人 2021-02-02 09:57

I have come across a regular expression that I don\'t fully understand - can somebody help me in deciphering it:

^home(?:\\/|\\/index\\.asp)?(?:\\?.+)?$
<         


        
4条回答
  •  伪装坚强ぢ
    2021-02-02 10:50

    From documentation:

    (?:...)
    A non-capturing version of regular parentheses. Matches whatever regular expression is inside the parentheses, but the substring matched by the group cannot be retrieved after performing a match or referenced later in the pattern.
    

提交回复
热议问题