[thelist] Search and replace

Adrian Fischer adrian at logo-logic.com
Fri Sep 28 04:07:05 CDT 2001


Hi Gang,

thanks for you repsonses to the regex questions...I think Im getting the
hang of it.
Unitl now.
I need to extract email addresses from a mailto links
mailto:blah at balh.com?subject=moreblah
in perl I need to match the mailto: and replace it with nothing and the same
with ?subject.......
If I can I need to make it generic enough to recognize that there may be no
subject line and process just the mailto bit.
So Im thinking that maybe if I can find the ? in the string the I can delete
all after.
I think I can adapt what I have learnt from some previous posts toget rid of
the mailto. Hows this:
$textstring="mailto:blah at balh.com?subject=moreblah"
$textstring=^(.{7,80})/;
Hmm...maybe not.  I think I just told it to start at the beginningof the
string, find everything but newlines, starting at the the 7th character and
go through until the 80th character.  I need to be able go through the
string untiil it finds the ? then delete all after that.

Am I on the right track.  This regex stuff is kicking my butt.  How many
years does it take before it becomes intuitive?

Thanks again

Adrian Fischer





More information about the thelist mailing list