In Jquery there is a regexp patten definition
var rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g;
this pattern matches strings like “abc,[” and “abc:[“, but not for “abc^[“.
So what’s the meaning of this part in the pattern:
(?:^|:|,)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
(?: ... )is a group (like(...)) that doesn’t capture anything.So your example
(?:^|:|,)simply matches either the start of the text, a colon, or a comma.It sounds like you don’t know what
^means – in a regex, it means “the start of the string” (unless you’ve turned on multi-line mode, where it means “the start of the line”).