Re: Regex to grab specific text from message

2002-07-31 Thread Blarp

Hi Januk,

B From: Joe Blow [EMAIL PROTECTED]

JA I'm assuming there is always a name portion for the following.  If
JA that is not true, we can work around it, but it means using a more
JA intimidating looking macro.

JA For the name, use:%REGEXPTEXT='(?i-s)\sFrom:\s*\(.*?)\'
JA For the address, use: %REGEXPTEXT='(?i-s)\sFrom:.*?\(.*?)\'

Neither of these works for me. In trying to read them, I get,

(?i-s) = Turn on caseless, turn off dot matching newline.
\s = any whitespace character
From:
\s = any whitespace char
*\ = 0 or 1  chars
(.*?) = 0 or 1 instances of anything
\ = must have 

The first line of the e-mail being replied to can any one of:

From: Vinnie [EMAIL PROTECTED] or

From: Vinnie Smith [EMAIL PROTECTED] or

From: Vinnie [EMAIL PROTECTED]

From: Vincent Q. Smith [EMAIL PROTECTED]

The only consistent element is the address which appears to always be
formatted the same.

In your example, it looks like the first  char is optional but the
second is not. Then there is the whitespace in front of the word
From:. I tried changing those but it had no effect. The regex
produces nothing.

I'm trying to understand this stuff but it's tough on the brain. ;-)

--
Tom G.
http://blarp.com -- Free tech support

The Bat 1.61 - Windows 2000


__
Archives   : http://tbtech.thebat.dutaint.com
Moderators : mailto:[EMAIL PROTECTED]
Unsubscribe: mailto:[EMAIL PROTECTED]




Re: Regex to grab specific text from message

2002-07-31 Thread Januk Aggarwal

Hello Blarp,

On Tuesday, July 30, 2002 at 11:35 PM, a beagle known as Blarp [B]
barked:

B (?i-s) = Turn on caseless, turn off dot matching newline.
B \s = any whitespace character
B From:
B \s = any whitespace char

Yes.

B *\ = 0 or 1  chars

Nope.  The * works on the previous \s.  It says 0 or more white space
characters and 1  character.

B (.*?) = 0 or 1 instances of anything

Nope.  It is the fewest number of 0 or more of any character.

B \ = must have 

Right.

B From: Vinnie [EMAIL PROTECTED] or
B From: Vinnie Smith [EMAIL PROTECTED] or
B From: Vinnie [EMAIL PROTECTED]
B From: Vincent Q. Smith [EMAIL PROTECTED]

For the name, try:
%REGEXPTEXT='(?im-s)^From:\s*\?(.*?)\?\s*\'

You can try the following for the other regexp.
%REGEXPTEXT='(?im-s)^From:.*?\(.*?)\'

-- 
Thanks for writing,
 Januk Aggarwal

I've determined the momentum of my physics assignment so precisely
that it can be anywhere in the universe right now.


__
Archives   : http://tbtech.thebat.dutaint.com
Moderators : mailto:[EMAIL PROTECTED]
Unsubscribe: mailto:[EMAIL PROTECTED]




Re: Regex to grab specific text from message

2002-07-31 Thread Blarp

Hi Januk,

JA For the name, try:
JA %REGEXPTEXT='(?im-s)^From:\s*\?(.*?)\?\s*\'

That works! Thanks a lot! Now I'm going to have to figure it out.G

Tom


__
Archives   : http://tbtech.thebat.dutaint.com
Moderators : mailto:[EMAIL PROTECTED]
Unsubscribe: mailto:[EMAIL PROTECTED]