Help with Regexp, please
On Sat, 1 May 2010 17:32:04 -0400, "Rick Rothstein"
wrote:
Just in case you are interested, here is some non-RegEx code that finds the
same part of your text (the result is returned in the variable named
TailEnd)...
Text = "NRK2D 986123456789312 Raffles Traders"
For X = 1 To Len(Text)
If Mid(Text, X, 15) Like String(15, "#") Then
TailEnd = Mid(Text, X + 15)
Exit For
End If
Next
--
Rick (MVP - Excel)
Rick,
The OP's original regex (\d{15,16}) will capture the first 15 *OR 16* digit
string into capture group 1. So when the *rest* of the string is returned, it
will omit digit 16 if present.
Your code will return the 16th digit, if present, as a part of "TailEnd"
--ron
|