
August 26th, 2011, 06:01 PM
|
 |
Contributing User
|
|
Join Date: Sep 2007
Location: outside Washington DC
|
|
|
Can you use the number of matched characters later in the regex?
I'm using Java's regex engine. I've got data that matches:
Quote: | (\\d{8}+|\\p{Upper}{2}\\d{6}+|\\p{Upper}\\d{7}+) |
What it really means is any of:
eight digits
or two letters and six digits
or one letter and seven digits.
It would be cool if I could have some sort of backreference to the number of characters matched in the pattern so I could use something like
Is this possible?
Thanks
Pat
|