[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Regular Expression Problem



Hi,

I'm using mutt, and I'm trying to get a regular expression that will work
with mozilla forwrded messages.

set reply_regexp = "^([[]?(re|aw|fwd|fw):[ \t]+)*)?"

With an origional message subject of "abc" this will match:

re: abc
re: re: abc
[re: [re: [re: abc

and the same for aw, fwd, and fw.

Now I come to a problem that I don't know how to fix.  With these regular
expressions, all I have to do is match the begining of the subject and don't
have to think of the end, as that doesn't change.  But with mozilla
forwarded messages, each time in encloses the subject with [] characters,
and now I have to match the end too.  So I tried appending using:

set reply_regexp = "^([[]?(re|aw|fwd|fw):[ \t]+)*(.*[]])?)?"

By adding "(.*[]])?", but that patches the entire subject on mozilla
forwarded messages (not something we want). :(

Frankly, I don't know how to skip matching a center part of a pattern, and
match the end only with mutt regexes.

So, is there anyone out there that can match: 

[fwd: abc]

that doesn't also match?:

[fwd: anything else you can think of here]

If someone does, please show me how you did it.

Thanks.

Oh, and for everyone who took the time to read my entire message, here's a
nice regex that will thread your mozilla bugmail (appended to the above regex):

set reply_regexp = 
"^([[]?(re|aw|fwd|fw):[ \t]+)*)?([[]bug.*[0-9]*[]]( new:)?)?"

Mike



Reply to: