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

[MacPerl-AnyPerl] Regular Expression Problem



I need to develop a regular expression that will embed html links in 
some text that contains extensive cross references. For example:

See also blue; green; red.

needs to become:

See also <A HREF="/cgi-bin/myscript.pl?blue">blue</A>; <A 
HREF="/cgi-bin/myscript.pl?green">green</A>; <A 
HREF="/cgi-bin/myscript.pl?red">red</A>.

Finding the references and dealing with the first one within each 
group is no problem, but I am not clear about how to handle all of 
them before moving on to find the next instance of See also. The 
ground rules are that the passages will always start with See also 
followed by a space and at least one reference which could have 
multiple words. If there are multiple references, they are delimited 
with a semi-colon and, in any case, a period terminates the entire 
string. The way that the text file is structured, everything will be 
on one physical line.

My thought was to first do a match for /See also [^\.]+\.+?/ and then 
try to do something with the results with s/$&// , but it isn't clear 
to me how to approach this? Would I need to make multiple passes or 
what? Thanks for any help you may be able to offer.

Richard Gordon
--------------------
Gordon Consulting & Design
Database Design/Scripting Languages
mailto://maccgi@bellsouth.net
770.565.8267

==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-anyperl-request@macperl.org