Hi Mark,

@16-Mar-2003, 08:38 Mark said:

> I'm a newbie and this may be a FAQ, but I can't find the
> answer.

It's actually not an FAQ, so let's see if there is any help for you!

> I want a regex macro to remove a frequently appearing chunk of
> constant text

 ... <snip>

> eg.

> *=*=*=*=*=*=*=*=*=*
> Dr Jo Price
> Lecturer in Bloggins
> Dept of xxxxx
> University of xxx
> -=-=-=-=-=-=-=-=-=-

> What to do if say the *=*=*=*=*=*=*=*=*=* and -=-=-=-=-=-=-=-=-=-
> is always present and the bit in between is variable??

Starting from the Quote Extraction macro from the FAQ library...

http://www.silverstones.com/thebat/Library.html#quote+extraction

%QUOTES='%SETPATTREGEXP="(?is)%-
((\s*)?\n?-----BEGIN PGP SIGNED.*?\n(Hash:.*?\n)?\s*)?%-
(\s*(Dear|Hi|Hello|Hey|Greetings|Howdy) \S*?\s*\n+)?%-
(-+[\S ]+\n)?%-
(.*?)(^(%-
- -*?\s*?--\s*\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="7"'

The two insertion point for new delimiter strings are around this
line.

(.*?)(^(%-

Like so:

(\*=\*=\*=\*=\*=\*=\*=\*=\*=\*\n)?%-
(.*?)(^(%-
>*\s*-=-=-=-=-=-=-=-=-=-\n|

and change the final extraction to "SUBPATT="8"'

> As the next step, what to do if this chunk of text has variable
> numbers of >'s associated?

Done! In this case, the preamble cut only focuses on what
immediately precedes the required text while the end marker
specifies >*\s? to say any number of (or zero) '>'s followed by
(zero or more) spaces.

-- 
Cheers -- .\\arck D Pearlstone -- List moderator
TB! v1.63 Beta/7 on Windows 2000 5.0.2195 Service Pack 2
'
(Message not PGP signed because of QT macros containing lines
starting with '-').



________________________________________________________
 Current version is 1.61 | "Using TBTECH" information:
http://www.silverstones.com/thebat/TBUDLInfo.html

Reply via email to