Tony
Tony

Reputation: 3409

Regular expression with (?:

I am new to regular expression and trying to find out what this means.

(?:(?:^KC[\\x00-\\xff]{50}))

Upon looking up online, ?: means no backtrace, I am not sure what that means? Also from ^ , does that mean a line that does not contain "KC...." for 50 character long?

Upvotes: 0

Views: 96

Answers (1)

Lev Levitsky
Lev Levitsky

Reputation: 65851

When you use brackets () in regex, you can use references (\1..\9) to captured groups further in the regex. Example: (a|b)_\1 will match 'a_a' and 'b_b'.

?: means that the captured group won't have a number (actually, it's better to say that it won't be captured, it's just a group).

^ means negation in character classes (in []). Outside [] it means beginning of the line.

Upvotes: 2

Related Questions