Re: FixSigs RegExp question/problem

2002-07-31 Thread Jonathan Angliss

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Wednesday, July 31, 2002, Jernej Simončič wrote...

JA>> Doesn't seem to match the "- Original Message -" Outlook uses,
JA>> at least not here anyway, I just copied and pasted it.

> Hmm... That's strange. It works in some cases, but not every time...

Which was why, in mine I had the following:

  \s*Orig.*

Which should match any repeated number of - and/or a space... or so
matches the RegExp tester.  This would mean it could match:

  "Original"
  "-Original"
  " Original"
  "- Original"
  etc etc

- --
Jonathan Angliss
([EMAIL PROTECTED])

-BEGIN PGP SIGNATURE-
Version: 6.5.8ckt

iQA/AwUBPUgqayuD6BT4/R9zEQIBKgCghoMUJjNhPVQTumiL8LbeO0nlPzEAn3ok
J5gDYXQGHRumBBKnWmUGuRSU
=RXfg
-END PGP SIGNATURE-



Current Ver: 1.61
FAQ: http://faq.thebat.dutaint.com 
Unsubscribe: mailto:[EMAIL PROTECTED]
Archives   : http://tbudl.thebat.dutaint.com
Moderators : mailto:[EMAIL PROTECTED]
TBTech List: mailto:[EMAIL PROTECTED]
Bug Reports: https://www.ritlabs.com/bt/



Re: FixSigs RegExp question/problem

2002-07-31 Thread Jernej Simončič

Hello Jonathan,
 
31. julij 2002, 19:55:52, you wrote:

JA> Doesn't seem to match the "- Original Message -" Outlook uses,
JA> at least not here anyway, I just copied and pasted it.

Hmm... That's strange. It works in some cases, but not every time...

-- 
Jernej Simoncic, [EMAIL PROTECTED]
http://www2.arnes.si/~sopjsimo/
ICQ: 26266467

[The Bat! v1.60d on Windows 2000 5.0.2195.Service Pack 2]

The closest library doesn't have the material you need.
   -- Researchers Law



Current Ver: 1.61
FAQ: http://faq.thebat.dutaint.com 
Unsubscribe: mailto:[EMAIL PROTECTED]
Archives   : http://tbudl.thebat.dutaint.com
Moderators : mailto:[EMAIL PROTECTED]
TBTech List: mailto:[EMAIL PROTECTED]
Bug Reports: https://www.ritlabs.com/bt/



Re: FixSigs RegExp question/problem

2002-07-31 Thread Jonathan Angliss

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Wednesday, July 31, 2002, Jernej Simončič wrote...

> This seems to work for me:

[snip]

Doesn't seem to match the "- Original Message -" Outlook uses,
at least not here anyway, I just copied and pasted it.

- --
Jonathan Angliss
([EMAIL PROTECTED])

-BEGIN PGP SIGNATURE-
Version: 6.5.8ckt

iQA/AwUBPUgkriuD6BT4/R9zEQIeUACdHrkIJDJr9A/6xv+K4GtLy3LXkOoAnApp
Z8WmoRH+az5at9t8w/3EaoQ4
=/AR8
-END PGP SIGNATURE-



Current Ver: 1.61
FAQ: http://faq.thebat.dutaint.com 
Unsubscribe: mailto:[EMAIL PROTECTED]
Archives   : http://tbudl.thebat.dutaint.com
Moderators : mailto:[EMAIL PROTECTED]
TBTech List: mailto:[EMAIL PROTECTED]
Bug Reports: https://www.ritlabs.com/bt/



Re: FixSigs RegExp question/problem

2002-07-31 Thread Jernej Simončič

Hello Jonathan,
 
31. julij 2002, 18:13:51, you wrote:

JA> And other permutations of that too.  Why is it not working when listed
JA> in this format?

This seems to work for me:

%QUOTES='%SETPATTREGEXP="(?is)%-
((\s*)?\n?-BEGIN PGP SIGNED.*?\n(Hash:.*?\n)?\s*)?%-
(--+\s+.*roups.*~--\>\n.*\n--+~-\>\n\n)?%-
(.*?)(^(- -*?\s*?--\s*\n|%-
(^\n*)_{40,}\s*\n|%-
-{40,}\s*\n|%-
\n-BEGIN PGP SIGNATURE.*s?\n|%-
--+\s+.*roups.*~--\>)|%-
\n\nYour use of|%-
\n+Get your FREE download|%-
\nNote that the email address of the sender has been changed|%-
\n---\nOutgoing mail is certified Virus Free.|%-
\z)"%REGEXPBLINDMATCH="%text"%SUBPATT="5"'

-- 
Jernej Simoncic, [EMAIL PROTECTED]
http://www2.arnes.si/~sopjsimo/
ICQ: 26266467

[The Bat! v1.60d on Windows 2000 5.0.2195.Service Pack 2]

There are four kinds of people: those who sit quietly and do nothing,
those who talk about sitting quietly and doing nothing, those who do
things, and those who talk about doing things.
   -- Runamok's Law



Current Ver: 1.61
FAQ: http://faq.thebat.dutaint.com 
Unsubscribe: mailto:[EMAIL PROTECTED]
Archives   : http://tbudl.thebat.dutaint.com
Moderators : mailto:[EMAIL PROTECTED]
TBTech List: mailto:[EMAIL PROTECTED]
Bug Reports: https://www.ritlabs.com/bt/



Re: FixSigs RegExp question/problem

2002-07-31 Thread Jonathan Angliss

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Wednesday, July 31, 2002, Jonathan Angliss wrote...

> %quotes='%SETPATTREGEXP="(?is)((\s*)?\n?-BEGIN PGP %-
> SIGNED.*?\n(Hash:.*?\n)?\s*)?(.*?)(^(-*?\s*?--\s*\n|%-
> _{40,}\s*\n|%-
> \n-BEGIN PGP SIGNATURE.*s?\n|%-
> - \s*Orig.*?|%-
> - -+\s+.*roups.*~--\>)|%-
> \n+Get your FREE download|%-
> \z)"%REGEXPBLINDMATCH="%text"%SUBPATT="4"'

Erm... due to PGP fixing those lines, they came out incorrect, remove
the "- " from the lines that have them, and there is my normal regexp.

> - - Original Message -
> - Original Message
> -  Original Message 

Same here :P

- --
Jonathan Angliss
([EMAIL PROTECTED])

-BEGIN PGP SIGNATURE-
Version: 6.5.8ckt

iQA/AwUBPUgNuiuD6BT4/R9zEQIRCwCguFlB0foLYvQC0z+oHYRjzf/JLEwAn10Z
3Z1s+r2llejVS9d5KGj02T1D
=B8Wl
-END PGP SIGNATURE-



Current Ver: 1.61
FAQ: http://faq.thebat.dutaint.com 
Unsubscribe: mailto:[EMAIL PROTECTED]
Archives   : http://tbudl.thebat.dutaint.com
Moderators : mailto:[EMAIL PROTECTED]
TBTech List: mailto:[EMAIL PROTECTED]
Bug Reports: https://www.ritlabs.com/bt/



FixSigs RegExp question/problem

2002-07-31 Thread Jonathan Angliss

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi,

I'm playing with the Fixing Signatures regexp on the FAQ site, and I
tried to add another line so that it strips out Outlook added reply
formatting, as a lot of my contacts use it.  Here is what it looks
like:

%quotes='%SETPATTREGEXP="(?is)((\s*)?\n?-BEGIN PGP %-
SIGNED.*?\n(Hash:.*?\n)?\s*)?(.*?)(^(-*?\s*?--\s*\n|%-
_{40,}\s*\n|%-
\n-BEGIN PGP SIGNATURE.*s?\n|%-
- \s*Orig.*?|%-
- -+\s+.*roups.*~--\>)|%-
\n+Get your FREE download|%-
\z)"%REGEXPBLINDMATCH="%text"%SUBPATT="4"'

You can see the "\s*Orig.*?" section has been added.  In the
RegExpTester listed on the site, this matches the Outlook reply
headers:

- - Original Message -
- Original Message
-  Original Message 

And other permutations of that too.  Why is it not working when listed
in this format?

- --
Jonathan Angliss
([EMAIL PROTECTED])

-BEGIN PGP SIGNATURE-
Version: 6.5.8ckt

iQA/AwUBPUgMxCuD6BT4/R9zEQKwNgCeP5oIqEQstF8zXliQ8jcvBJngzTsAoMIo
WBarKT8GsJQb1czpK759Ad8u
=DQUY
-END PGP SIGNATURE-



Current Ver: 1.61
FAQ: http://faq.thebat.dutaint.com 
Unsubscribe: mailto:[EMAIL PROTECTED]
Archives   : http://tbudl.thebat.dutaint.com
Moderators : mailto:[EMAIL PROTECTED]
TBTech List: mailto:[EMAIL PROTECTED]
Bug Reports: https://www.ritlabs.com/bt/



Re: RegExp Question

2000-12-22 Thread Januk Aggarwal

Hello Brian,

On  Fri, 22 Dec 2000  at  03:36:42 GMT -0500 (which was 12:36 AM
where I live) witnesses say Brian Clark typed:



JA>> ... the delimiters for the %QUOTES macro is single double quotes.
JA>> Therefore a different delimiter needs to be used, and so double double
JA>> quotes were used.
 
> OK, then this should be equivalent to the original, right?


Barring any typos I'm not seeing, that is correct.

> I should probably just be trying this myself..

Feel free to experiment.  I have a QT called 'tester'.  Any time I
want to test some template fragment, I put it in there, then from an
editor I can manually apply the template quickly.  It makes efficient
development easy.
 

-- 
Thanks for writing,
 Januk Aggarwal

 Using The Bat! 1.48f
 under Windows 98 4.10 Build   A 

-- 
--
View the TBUDL archive at http://tbudl.thebat.dutaint.com
To send a message to the list moderation team double click here:
   
To Unsubscribe from TBUDL, double click here and send the message:
   
--

You are subscribed as : archive@jab.org





Re: RegExp Question

2000-12-22 Thread Stuart Tares

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Januk,

On Fri, 22 Dec 2000, at 00:04:59 (which was 08:04 where I live) you
wrote :

JA> No, it was intentional.  I wanted to be consistent with what the
JA> original poster was using.  :-)

Who wanted to be consistent with all the examples that he had seen.
Thanks once again, Januk, for a clear and concise explanation of why
it is like this.

Stuart

- --
And now for something completely different...

-BEGIN PGP SIGNATURE-
Version: PGP 6.5i
Comment: Digitally signed for sender verification.

iQA/AwUBOkMUOHjB/5h2FIaGEQKAiwCg3y+X+E/tQ/d9uoJAsMq+a7qyexEAoLgp
puOgF8oK60HI+yGuocVwkci+
=EBDU
-END PGP SIGNATURE-

-- 
--
View the TBUDL archive at http://tbudl.thebat.dutaint.com
To send a message to the list moderation team double click here:
   
To Unsubscribe from TBUDL, double click here and send the message:
   
--

You are subscribed as : archive@jab.org





Re: RegExp Question

2000-12-22 Thread Brian Clark


Hello Januk, 

(JA == "Januk Aggarwal") [EMAIL PROTECTED] writes:

>> ... from the "Strip PGP Signatures" example
>> in the Macros section of the FAQ:

>> [one line]
>> %quotes="%SETPATTREGEXP=""(?is)(^-BEGIN PGP 
>SIGNED.*?\n(Hash:.*?\n)?\s*)?(.*?)(^(-*?\s*?--
>> \s*\n|_{40,}\s*\n|-BEGIN PGP 
>SIGNATURE)|\z)""%REGEXPBLINDMATCH=""%text""%SUBPATT=""3"""
>> [one line]

>> Could you tell me why there needs to be two sets of double quotes
>> around the regular expression.



JA> This is because these three macros are arguments to the %Quotes macro,
JA> and the delimiters for the %QUOTES macro is single double quotes.
JA> Therefore a different delimiter needs to be used, and so double double
JA> quotes were used.
 
OK, then this should be equivalent to the original, right?

[one line]
%quotes='%SETPATTREGEXP="(?is)(^-BEGIN PGP 
SIGNED.*?\n(Hash:.*?\n)?\s*)?(.*?)(^(-*?\s*?--
\s*\n|_{40,}\s*\n|-BEGIN PGP SIGNATURE)|\z)"%REGEXPBLINDMATCH="%text"%SUBPATT="3"'
[one line]

I should probably just be trying this myself..

--
...
 Brian Clark <[EMAIL PROTECTED]> PGP-KeyID: 0xE4D0C7C8
 Web Architect, Designer, and Programmer  Tel: 864.227.0750
 http://www.fusionwerks.com/  Fax: 864.942.7249
...

-- 
--
View the TBUDL archive at http://tbudl.thebat.dutaint.com
To send a message to the list moderation team double click here:
   
To Unsubscribe from TBUDL, double click here and send the message:
   
--

You are subscribed as : archive@jab.org





Re: RegExp Question

2000-12-22 Thread Januk Aggarwal

Hello Brian,

On  Fri, 22 Dec 2000  at  03:16:56 GMT -0500 (which was 12:16 AM
where I live) witnesses say Brian Clark typed:

> OK, now I'm confused. I tend to get that way with plenty of things, as
> some of you *cough* Marck, Allie *cough* *cough* know.

 No problem.

> ... from the "Strip PGP Signatures" example
> in the Macros section of the FAQ:

> [one line]
> %quotes="%SETPATTREGEXP=""(?is)(^-BEGIN PGP 
>SIGNED.*?\n(Hash:.*?\n)?\s*)?(.*?)(^(-*?\s*?--
> \s*\n|_{40,}\s*\n|-BEGIN PGP 
>SIGNATURE)|\z)""%REGEXPBLINDMATCH=""%text""%SUBPATT=""3"""
> [one line]

> Could you tell me why there needs to be two sets of double quotes
> around the regular expression:

> %SETPATTREGEXP=""(?is)(^-BEGIN PGP SIGNED.*?\n(Hash:.*?\n)?\s*)?(.*?)(^(-*?\s*?--
> \s*\n|_{40,}\s*\n|-BEGIN PGP SIGNATURE)|\z)""

> and:

> %REGEXPBLINDMATCH=""%text""

> and this:

> %SUBPATT=""3""

This is because these three macros are arguments to the %Quotes macro,
and the delimiters for the %QUOTES macro is single double quotes.
Therefore a different delimiter needs to be used, and so double double
quotes were used.
 

-- 
Thanks for writing,
 Januk Aggarwal

 Using The Bat! 1.48f
 under Windows 98 4.10 Build   A 

-- 
--
View the TBUDL archive at http://tbudl.thebat.dutaint.com
To send a message to the list moderation team double click here:
   
To Unsubscribe from TBUDL, double click here and send the message:
   
--

You are subscribed as : archive@jab.org





Re: RegExp Question

2000-12-22 Thread Stuart Tares

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Januk,

On Thu, 21 Dec 2000, at 13:15:21 (which was 21:15 where I live) you
wrote :

>> 2) Set everything up to the -=-=-=- as %SUBPATT0

JA> Ah, this is your mistake. %SUBPATT="0" is reserved for the entire
JA> match.  So in your case you're matching everything including the
sig.

Ahh!  Now that I have gone back and re-read the help pages, this
becomes clear.  I thought I had tried everything but obviously not
:-)

JA> BTW, you can simplify the regexp to:
JA>
JA> 
JA>
%Quotes='%SETPATTREGEXP="(?is)(.*?)(\n-=-=-=-\n\[.*\])"%REGEXPBLINDMAT
CH="%TEXT"%SUBPATT="1"'
JA> 

I was going to try to simplify the regexp once I had got it working,
so thanks very much for doing it for me.  I was working on the
premise of making sure that I grabbed everything and then simplify
it.

Thanks very much for the help.  I have found this group to be very
useful in my learning of TB and hope that I can help others in the
future.

Stuart

- --
A conclusion is simply the place where you got tired of thinking.

-BEGIN PGP SIGNATURE-
Version: PGP 6.5i
Comment: Digitally signed for sender verification.

iQA/AwUBOkMOLHjB/5h2FIaGEQKxzgCffbrfHyUXF+LwEE5dAR/whCZ7rZ0An2H2
F9dM2hjE2RNn0YudPwo5Tq/6
=grya
-END PGP SIGNATURE-

-- 
--
View the TBUDL archive at http://tbudl.thebat.dutaint.com
To send a message to the list moderation team double click here:
   
To Unsubscribe from TBUDL, double click here and send the message:
   
--

You are subscribed as : archive@jab.org





Re: RegExp Question

2000-12-22 Thread Brian Clark


Hello Januk, 

(JA == "Januk Aggarwal") [EMAIL PROTECTED] writes:

>> It just threw me off when you doubled-up double quotes like
>> %NAME=""value""

>> I thought you may have made a typo, and it appears that you did.

JA> No, it was intentional.  I wanted to be consistent with what the
JA> original poster was using.  :-)

OK, now I'm confused. I tend to get that way with plenty of things, as
some of you *cough* Marck, Allie *cough* *cough* know.

I'm assuming Stuart borrowed from the "Strip PGP Signatures" example
in the Macros section of the FAQ:

[one line]
%quotes="%SETPATTREGEXP=""(?is)(^-BEGIN PGP 
SIGNED.*?\n(Hash:.*?\n)?\s*)?(.*?)(^(-*?\s*?--
\s*\n|_{40,}\s*\n|-BEGIN PGP 
SIGNATURE)|\z)""%REGEXPBLINDMATCH=""%text""%SUBPATT=""3"""
[one line]

Could you tell me why there needs to be two sets of double quotes
around the regular expression:

%SETPATTREGEXP=""(?is)(^-BEGIN PGP SIGNED.*?\n(Hash:.*?\n)?\s*)?(.*?)(^(-*?\s*?--
\s*\n|_{40,}\s*\n|-BEGIN PGP SIGNATURE)|\z)""

and:

%REGEXPBLINDMATCH=""%text""

and this:

%SUBPATT=""3""

--
...
 Brian Clark <[EMAIL PROTECTED]> PGP-KeyID: 0xE4D0C7C8
 Web Architect, Designer, and Programmer  Tel: 864.227.0750
 http://www.fusionwerks.com/  Fax: 864.942.7249
...

-- 
--
View the TBUDL archive at http://tbudl.thebat.dutaint.com
To send a message to the list moderation team double click here:
   
To Unsubscribe from TBUDL, double click here and send the message:
   
--

You are subscribed as : archive@jab.org





Re: RegExp Question

2000-12-21 Thread Januk Aggarwal

Hello Brian,

On  Fri, 22 Dec 2000  at  02:34:58 GMT -0500 (which was 11:34 PM
where I live) witnesses say Brian Clark typed:

> Hello Januk, 


> It just threw me off when you doubled-up double quotes like
> %NAME=""value""

> I thought you may have made a typo, and it appears that you did.

No, it was intentional.  I wanted to be consistent with what the
original poster was using.  :-)

 

-- 
Thanks for writing,
 Januk Aggarwal

 Using The Bat! 1.48f
 under Windows 98 4.10 Build   A 

-- 
--
View the TBUDL archive at http://tbudl.thebat.dutaint.com
To send a message to the list moderation team double click here:
   
To Unsubscribe from TBUDL, double click here and send the message:
   
--

You are subscribed as : archive@jab.org





Re: RegExp Question

2000-12-21 Thread Brian Clark


Hello Januk, 

(JA == "Januk Aggarwal") [EMAIL PROTECTED] writes:

JA> Hello Brian,

JA> On  Fri, 22 Dec 2000  at  01:25:48 GMT -0500 (which was 10:25 PM
JA> where I live) witnesses say Brian Clark typed:

>> Why are you using two sets of quotes around the value? I've seen
>> similar in some of the examples in the FAQ, I think.

>> What's different about %SUBPATT="1" (or for that matter,
>> %SUBPATT='1')?

>> Am I missing something?

JA> Excellent question.

JA> There is no difference between single quotes and double quotes, it
JA> just makes life easier to use a mix.  Hopefully the reason for this
JA> will become clear.



JA> This seems a bit confusing when written out.  Try to work out what TB
JA> sees, and ask any questions that may arise.

Not at all. Because I'm assuming %MACRO1="%MACRO2=\"%MACRO3\"" won't
cut it. From the languages I know, double quotes interpolate, single
quotes do not. But, I understood your explanation (snipped).

It just threw me off when you doubled-up double quotes like
%NAME=""value""

I thought you may have made a typo, and it appears that you did.

That's why I did the double-take. :)

--
...
 Brian Clark <[EMAIL PROTECTED]> PGP-KeyID: 0xE4D0C7C8
 Web Architect, Designer, and Programmer  Tel: 864.227.0750
 http://www.fusionwerks.com/  Fax: 864.942.7249
...

-- 
--
View the TBUDL archive at http://tbudl.thebat.dutaint.com
To send a message to the list moderation team double click here:
   
To Unsubscribe from TBUDL, double click here and send the message:
   
--

You are subscribed as : archive@jab.org





Re: RegExp Question

2000-12-21 Thread Januk Aggarwal

Hello Brian,

On  Fri, 22 Dec 2000  at  01:25:48 GMT -0500 (which was 10:25 PM
where I live) witnesses say Brian Clark typed:

> Why are you using two sets of quotes around the value? I've seen
> similar in some of the examples in the FAQ, I think.

> What's different about %SUBPATT="1" (or for that matter,
> %SUBPATT='1')?

> Am I missing something?

Excellent question.

There is no difference between single quotes and double quotes, it
just makes life easier to use a mix.  Hopefully the reason for this
will become clear.

The quotes (single and double) are delimiters that indicate the
boundaries for arguments to macros.  So =" or =' is the start of the
arguments, and a closing quote is the end.

When you have a macro that accepts arguments, the arguments can be
macros that need arguments.  Confused?  Perhaps an example is in
order.  Suppose we want to use a regular expression to clean up the
subject line.

%Subject="some regexp"

Where "some regexp" is something like:

%SETPATTREGEXP=":(.*)"%REGEXPBLINDMATCH="%OFULLSUBJ"%SUBPATT="1"

Now if you were to literally replace that regular expression line into
the %Subject macro, how is TB to know that you want all of it?
According to the rules, if we use:

%Subject="%SETPATTREGEXP=":(.*)"%REGEXPBLINDMATCH="%OFULLSUBJ"%SUBPATT="1""

TB thinks that the subject field should be filled with the value:
%SETPATTREGEXP=

That's not what you wanted.  One option around this is to double up
the inner quotation marks.  That's what Stuart had done, so I followed
suit.

The other option is to replace either the inner or outer argument (not
both) delimiters with single quotes.  So the macro looks like:

%Subject='%SETPATTREGEXP=":(.*)"%REGEXPBLINDMATCH="%OFULLSUBJ"%SUBPATT="1"'

Here, I replaced the outer quotes.  So the %Subject macro has an
opening delimiter =' and therefore it looks for the closing delimiter '
Note that you can make this almost arbitrarily complicated, you just
keep adding quotes.  So if you had a macro within a macro within a
macro that needed arguments, you'd need ', '', and '''.  Phew.

This seems a bit confusing when written out.  Try to work out what TB
sees, and ask any questions that may arise.

-- 
Thanks for writing,
 Januk Aggarwal

 Using The Bat! 1.48f
 under Windows 98 4.10 Build   A 

-- 
--
View the TBUDL archive at http://tbudl.thebat.dutaint.com
To send a message to the list moderation team double click here:
   
To Unsubscribe from TBUDL, double click here and send the message:
   
--

You are subscribed as : archive@jab.org





Re: RegExp Question

2000-12-21 Thread Brian Clark


Hello Januk, 

(JA == "Januk Aggarwal") [EMAIL PROTECTED] writes:

JA> That's good. However, as I explained above, you're capturing one
JA> subpattern to small. Make it %SUBPATT=""1"" and it should work.

Why are you using two sets of quotes around the value? I've seen
similar in some of the examples in the FAQ, I think.

What's different about %SUBPATT="1" (or for that matter,
%SUBPATT='1')?

Am I missing something?

--
...
 Brian Clark <[EMAIL PROTECTED]> PGP-KeyID: 0xE4D0C7C8
 Web Architect, Designer, and Programmer  Tel: 864.227.0750
 http://www.fusionwerks.com/  Fax: 864.942.7249
...



-- 
--
View the TBUDL archive at http://tbudl.thebat.dutaint.com
To send a message to the list moderation team double click here:
   
To Unsubscribe from TBUDL, double click here and send the message:
   
--

You are subscribed as : archive@jab.org





Re: RegExp Question

2000-12-21 Thread Januk Aggarwal

Hello Stuart,

On  Thu, 21 Dec 2000  at  17:38:35 GMT + (which was 9:38 AM
where I live) witnesses say Stuart Tares typed:

> I though that it would have been a relatively easy thing to set up
> but am getting nowhere.

It takes a while.  You made a great attempt.

> I was thinking that the logic for the regexp
> would be:

> 1) Take all the text of the message

Correct.

> 2) Set everything up to the -=-=-=- as %SUBPATT0

Ah, this is your mistake.  %SUBPATT="0" is reserved for the entire
match.  So in your case you're matching everything including the sig.

> 3) Set (-=-=-=-\n\[.*\]\n\[.*\]\n) as %SUBPATT1

In your regexp, this is actually a higher subpattern.  I think it is
Subpattern 3.  Try it and see what number it takes before you get the
signature only.

> You could then set %QUOTES to the output of %SUBPATT0.  This is what
> I came up with:

> 
> %QUOTES="%SETPATTREGEXP=""(?is)((.*\n)*)(-=-=-=-\n\[.*\]\n\[.*\]\n)""%
> REGEXPBLINDMATCH=""%TEXT""%SUBPATT=""0"""
> 

That's good.  However, as I explained above, you're capturing one
subpattern to small.  Make it %SUBPATT=""1"" and it should work.

> This, however, gives me two copies of the text both with the
> footer/signature in it !  I am sure that I am missing something
> extremely obvious but I just can't see it.

Subpattern 0 is the entire text that is matched.  The two copies are
probably because you have forgotten to remove one of the %quotes.  You
only need the one line that you posted.

What you want is stored in SubPattern 1.  The subpatterns are what is
in brackets.  Count the number of opening brackets to find the
subpattern number.

BTW, you can simplify the regexp to:


%Quotes='%SETPATTREGEXP="(?is)(.*?)(\n-=-=-=-\n\[.*\])"%REGEXPBLINDMATCH="%TEXT"%SUBPATT="1"'


The newlines are matched by the '.' in '.*' because of the mode you are
using.  Knowing this, the end part of the sig can also be simplified
because '*' is greedy (see the end for discussion of greedy).

This regexp will give you everything up to the block:

-=-=-=-
[blah blah blah]
[blah blah blah]

Take a look at %SUBPATT="2" and you will see the entire signature.

Explanation of Greedy:

When you use a variable length repeat operator (like *), the largest
pattern that matches the regular expression will be used.  For
example, if you have:

> [some text] [ some other text]

Now use the regexp "\[(.*)\]" and look at subpattern 1.  You'll see:

> some text] [ some other text

If you don't want that behaviour, you have to make * ungreedy (The
same applies for all the repeat operators).  Ungreedy repeats will
match the smallest pattern that satisfies the rest of the regular
expression.  To make it ungreedy, add a '?' after the repeat operator.
Note that '?' has two meanings depending on context.
If we had used the regexp, "\[(.*?)\]", now you'd get:

> some text

 

-- 
Thanks for writing,
 Januk Aggarwal

 Using The Bat! 1.48f
 under Windows 98 4.10 Build   A 

-- 
--
View the TBUDL archive at http://tbudl.thebat.dutaint.com
To send a message to the list moderation team double click here:
   
To Unsubscribe from TBUDL, double click here and send the message:
   
--

You are subscribed as : archive@jab.org





RegExp Question

2000-12-21 Thread Stuart Tares

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi there,

I am a new TB user and am trying to get to grips with the powerful
REGEXP within templates.

I subscribe to a mailing list which always ends it mailings with a
non-standard signature.  The format of this is as below:

- -=-=-=-
[ SOME TEXT ]
[ SOME MORE TEXT ]

I though that it would have been a relatively easy thing to set up
but am getting nowhere.  I was thinking that the logic for the regexp
would be:

1) Take all the text of the message
2) Set everything up to the -=-=-=- as %SUBPATT0
3) Set (-=-=-=-\n\[.*\]\n\[.*\]\n) as %SUBPATT1

You could then set %QUOTES to the output of %SUBPATT0.  This is what
I came up with:


%QUOTES="%SETPATTREGEXP=""(?is)((.*\n)*)(-=-=-=-\n\[.*\]\n\[.*\]\n)""%
REGEXPBLINDMATCH=""%TEXT""%SUBPATT=""0"""


This, however, gives me two copies of the text both with the
footer/signature in it !  I am sure that I am missing something
extremely obvious but I just can't see it.

Any help is very much appreciated.

Stuart

- --
No wanna work... wanna bang on keyboard!

-BEGIN PGP SIGNATURE-
Version: PGP 6.5i
Comment: Digitally signed for sender verification.

iQA/AwUBOkJAKnjB/5h2FIaGEQJXVwCgiOkfgMWnHQrByBoutUfNCXdYnbUAn3RA
35svbZHZTl4jDbP7/rCJwCnl
=hzHU
-END PGP SIGNATURE-

-- 
--
View the TBUDL archive at http://tbudl.thebat.dutaint.com
To send a message to the list moderation team double click here:
   
To Unsubscribe from TBUDL, double click here and send the message:
   
--

You are subscribed as : archive@jab.org





Re: a regexp question

2000-09-15 Thread Peter Steiner

On Fri, 15 Sep 2000 11:21:25 -0700, Jason Thompson wrote:

JT> You'll see that my signature looks like this:

JT> Jason Thompson mailto:[EMAIL PROTECTED]
JT> PGP Key ID: 0x3084BEC4 [The Bat! v1.46c]

JT> As you can see, the TB version has several spaces before it to make it
JT> appear "right justified". Since I keep up with the beta versions of
JT> TB, the %thebatversion string is frequently changing in length, so
JT> every time it changes I have to edit the number of spaces in my
JT> signature template.

JT> My question is, can TB do this work for me with a regexp?

I have found a way. Perhaps there are other more elegant ideas, but i
could not think of them...

%SETPATTREGEXP=" {5}\[.{13}\]| {4}\[.{14}\]| {3}\[.{15}\]"
%REGEXPMATCH="[The Bat! %THEBATVERSION]"
   spaces (enough of them!)

The key is that you combine several subpattern in the form
" {5}\[.{13}\]" (without quotes) for every possible length of your
version string. The first number is the number of digits it takes (5
in this example) when the string inside the brackets is 13 characters
long.

Make sure that in the REGEXPMATCH you put enough spaces for the
biggest variant (in my example '5').

My RE above is only a short example and works only for three different
lengths, but you should be able to expand it to any desired length.

HTH

Peter
-- 
Peter Steiner <[EMAIL PROTECTED]>

-- 
--
View the TBUDL archive at http://tbudl.thebat.dutaint.com
To send a message to the list moderation team double click here:
   
To Unsubscribe from TBUDL, double click here and send the message:
   
--

You are subscribed as : archive@jab.org





Re: a regexp question

2000-09-15 Thread Steve Lamb

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Friday, September 15, 2000, 11:21:25 AM, Jason wrote:
> My question is, can TB do this work for me with a regexp? The number

AFAIK, no.  Regexp is pattern matching and string replacement but does not
have such capabilities.

- --
 Steve C. Lamb | I'm your priest, I'm your shrink, I'm your
 ICQ: 5107343  | main connection to the switchboard of souls.
- ---+-

-BEGIN PGP SIGNATURE-
Version: PGP 6.5i

iQA/AwUBOcJvvHpf7K2LbpnFEQJH0ACffOQIopnD2j+XUK7Knxqzg06MqbkAoLbj
k0sD+5A8AJHxyJ1SvccJSzp9
=KVMT
-END PGP SIGNATURE-

-- 
--
View the TBUDL archive at http://tbudl.thebat.dutaint.com
To send a message to the list moderation team double click here:
   
To Unsubscribe from TBUDL, double click here and send the message:
   
--

You are subscribed as : archive@jab.org





a regexp question

2000-09-15 Thread Jason Thompson

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hello everyone...

You'll see that my signature looks like this:

Jason Thompson mailto:[EMAIL PROTECTED]
PGP Key ID: 0x3084BEC4 [The Bat! v1.46c]

As you can see, the TB version has several spaces before it to make it
appear "right justified". Since I keep up with the beta versions of
TB, the %thebatversion string is frequently changing in length, so
every time it changes I have to edit the number of spaces in my
signature template.

My question is, can TB do this work for me with a regexp? The number
of spaces that must be inserted can be calculated with very simple
math:

18 - (length of %thebatversion string)

However, I understand very little of regexps at the moment... Can
anyone think of a way for me to work this out? TIA

- --
Jason Thompsonmailto:[EMAIL PROTECTED]
PGP Key ID: 0x3084BEC4[The Bat! v1.46c]
- ---
God is real, unless declared integer.

//The Bat! v1.46c
//Win98 v4.10 build 1998
//AMD K6-2 400mhz 128mb

-BEGIN PGP SIGNATURE-
Version: PGP 6.5.8

iQA/AwUBOcJora2yGRAwhL7EEQJDQgCeIUtvp1KcZBD08V8pzbkaeVeN7K8An3YA
nuPiN3vht6PXHCZo1D342+ly
=VEpP
-END PGP SIGNATURE-

-- 
--
View the TBUDL archive at http://tbudl.thebat.dutaint.com
To send a message to the list moderation team double click here:
   
To Unsubscribe from TBUDL, double click here and send the message:
   
--

You are subscribed as : archive@jab.org