View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Help with Regexp, please

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)



"Raj" wrote in message
...
To clarify, the regex should return " Raffles Traders" from the string
below:

NRK2D 986123456789312 Raffles Traders

The regex (\d{15,16})([\s\S]*) is returning "986123456789312 Raffles
Traders"

Regards,
Raj



On May 2, 12:08 am, Lars-Åke Aspelin wrote:
On Sat, 01 May 2010 14:47:46 -0400, Ron Rosenfeld



wrote:
On Sat, 1 May 2010 05:39:32 -0700 (PDT), Raj wrote:


Hi,


The regular expression (\d{15,16}) matches a substring in a cell. I
want to extract the remaining part of the cell ie. from the character
after the matched substring till the end of the string in the cell
using a regular expression.


Is it possible to do this?


Thanks in advance for the help.


Regards,
Raj


(\d{15,16})([\s\S]*)


will capture everything in the cell and after your "match" into Group 2


--ron


Can't [\s\S] be replaced by . like this
(\d{15,16})(.*)

Lars-Åke