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

Re: Regular Expression Problem



On Wed, May 21, 2003 at 07:25:10PM -0400, Emma Jane Hogbin wrote:
> Ok, you have more close than open brackets. This will be a problem. 

Yeah, I noticed that after my initial post.

> Also:
> your entire regular expression is optional...
> 	()*()?
> Shouldn't there be at least some part that's required? Like "at least re
> or aw or fwd or fw"...For that you'd add another group. In very simplied
> terms:
> 	([)*(re|fwd|fw)+(])*
> 	an optional [ 
> 	at least one "re|fwd|fw" 
> 	with an optional ending ]
> 

Not really.  As you can see from my initial post, I had another RE appended
to the end to thread bugzilla messages.  I didn't include that here because
I wanted to show as simple a test case as possible (while showing what I'm
shooting for at the same time too).

So, I want it to match nothing if for whatever reason I get several messages
with the same subject but no "re:" or etc.  (spam is one such case, which is
nicely handled for me by spamassassin)

> Why do you have the "or" in there?
> 

See below...

> > I'm trying to match two outer parts of a string, without matching the center
> > part between the two outter parts.  Any new ideas would be helpful.
> 
> I usually find and end part with something like this: 
> 	[^endpattern]+
> i.e. as long as you're NOT my character class keep going. (must find at
> least one character that is not your character class -- which creates the
> "middle"ness)
> 

Ahh, but won't the negated character class also consider the middle part
(ie, NOT in the class) as a match of the RE?

This regular expression is used to match what should NOT be checked for an
exact match to another subject line.

In essence, what is matched by the RE is removed from consideration by the
subsequent compare after the RE was run on the subject line.

So this:

"[fwd: some great joke]"

should become like this to mutt:

"some great joke"

I want it to basically match the begining and the end specified by the RE,
but not the middle between, and I don't know how. :(

Thanks Emma for your time.  I hope you can help me find a solution.

Mike

Oh, here are my two updated REs:

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

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



Reply to: