Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Regular Expressions in VBA

Status
Not open for further replies.

Aidy680

Technical User
Nov 1, 2006
138
GB
Not sure if this is the right forum....

I have an expressions that reads currently:

\nSubject:\s{2}[A-Z]{3}\s{1}\d{2}

which finds the following:

Subject: DEC 07 AAAA (30) 20.7 EXAMPLE
X_MS_Has_Attach:

What expression would I now need to use to get just the first line? I tried using:

\r

which I thought would find the carraige return character but to no avail.

Anyone?
 
Are you using re.multiline = true? If so, try switching to false.

I'm far from an expert, but isn't \r carriage return? Could you try \n (newline)?

But, are you sure that pattern really returns the two lines, and not just

Subject: DEC 07

Roy-Vidar
 
Roy thanks for your reply.

No I'm not using multiline.

Also apologies but you're quite right. It only returns:

Subject: DEC 07

I'll give your "newline" suggestion a try and update here soon.
 
Sorry guys for the lack of follow-up on this but I got it working in the end so thanks for your assistance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top