Group in regular expression means treating multiple characters as a single unit. They are created by placing the characters to be grouped inside a set of parentheses – ”()”. Each set of parentheses corresponds to a group.
Backreferences are convenient, because it allows us to repeat a pattern without writing it again. We can just refer to the previous defined group by using \#(# is the group number).
Finding Repeated Pattern
(\\d\\d\\d)\\1
Read full article from Backreferences in Java Regular Expressions | Javalobby
Backreferences are convenient, because it allows us to repeat a pattern without writing it again. We can just refer to the previous defined group by using \#(# is the group number).
Finding Repeated Pattern
(\\d\\d\\d)\\1
Read full article from Backreferences in Java Regular Expressions | Javalobby
No comments:
Post a Comment