Hello dAniel, On Thursday, February 5, 2004 at 01:38 GMT +0100, special agents were informed that Daniel Hahler [DH] leaked:
DH> I tried this before.. %REGEXPMATCH is still empty Yes, this is correct. %Regexpmatch only gets populated with subpattern 1 if it exists, otherwise subpattern 0. In your expression, the test string gets matched by different subpattern. DH> and SUBPATT gets also set without "clear" subpatterns. I'm not sure what you mean. From your example below, the regexp seems to be working as it should. See below for more info. DH> So, what I want to do is getting the name of the mailinglist (before DH> the '@'), but for different lists. DH> This could be done easily with DH> %SETPATTREGEXP='(tbudl|tbot|otherml)@(thebat\.dutaint\.com|otherml\.com)' DH> But as this would also match '[EMAIL PROTECTED]' this is not optimal. This is the only way you'd get the list name in subpattern 1 every time. Well, that's not true. I suppose you could do it using two nested regexps. But that's even less optimal. In theory at least, you can have one expression extract the whole address, then extract the username with the other expression. The following should work, though with the new scope of regexp definitions, I'm not entirely sure. =====[Begin nested]===== %SetPattRegexp='^(.*)@'%- %RegExpMatch='%- %___%SetPattRegexp="(((tbudl|tbbeta|tbdev|tbtech|tbot)@thebat\.dutaint\.com)|((test)@test\.de)|((thebat-dt)@lists\.dekadent\.net))"%- %___%RegExpMatch="[EMAIL PROTECTED]"' =====[ End nested]===== If that doesn't work, you could do the same thing using variables: =====[Begin vars]===== %_Addr='%- %___%SetPattRegexp="(((tbudl|tbbeta|tbdev|tbtech|tbot)@thebat\.dutaint\.com)|((test)@test\.de)|((thebat-dt)@lists\.dekadent\.net))"%- %___%RegExpMatch="[EMAIL PROTECTED]"'%- %- %SetPattRegexp='^(.*)@'%- %RegExpMatch='%_Addr' =====[ End vars]===== DH> The idea in my approach was to have the username part of the ml DH> address in parenthesis and therefor as the result of %REGEXPMATCH, DH> regardless of which %SUBPATT number it is.. That can't be done because of how %REGEXPMATCH works. But you can simulate the effect. (See below) DH> I extended your test QT: So that seems to work exactly right. So in your template, use something like: =====[Begin QT fragment]===== %SetPattRegexp='((tbudl|tbbeta|tbdev|tbtech|tbot)@thebat\.dutaint\.com)|((test)@test\.de)|((thebat-dt)@lists\.dekadent\.net)'%- %RegexpBlindMatch='[EMAIL PROTECTED]'%- %Subpatt='2'%Subpatt='4'%Subpatt='6'%- =====[ End QT fragment]===== Since only one of them can match, only one of the subpatterns will be filled. As written, that means the other two %Subpatt calls do absolutely nothing to the string that will be returned. -- Thanks for writing, Januk Aggarwal ________________________________________________ http://www.silverstones.com/thebat/TBUDLInfo.html

