What does (?: do in a regular expression

后端 未结 4 1029
天涯浪人
天涯浪人 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:39

    its really easy every parentheses will create a variable in the memory so you can use the parentheses value afterward so to not save it in memory just put :? in the parentheses like this (?:) and then fill the rest as you need. that's it and nothing else

提交回复
热议问题