http://www.perlmonks.org?node_id=934485

emelianenko has asked for the wisdom of the Perl Monks concerning the following question:

Hello I dont want to imagine how annoying is to have a newbie asking question to gurus but the other forums, just did not bloody work i could not get logged in, i would get "akismetspam" sentence not found, and there was nothing for me to answer, well it was rubbish, so, sorry to bug you, I promise it will be just 1 question:

I have a paragraph like this:

<a href="page.aspx?a=c4bc46eswsdw32fcc">John.Martines </a></li><li><a +href="page.aspx?a=0a2b-a99d-3754eb2f5e35">Mary Jones</a></li><li><a h +ref="page.aspx?a=1ef7b100-8dc4-4b40-871c-68b1d0">Fernando Praderas</a +></li><li><a href="page.aspx?a=e8ec1d77-ee83-4797-b9c4-7676053a4926">

I just want to print the First and last name that you see scattered there but always between the same patterns. But if I am to tell the program to read line by line, they are differently divided, some times the content to print is split between two lines or some times is in the second line.

if ($line =~ /<a href="page.aspx?.*>.*</a>$/
it would have to remove all the junk I dont want and print just the remaining hmm so:
$line =~s/(<a href="page.aspx?*>$//.*s/</a>//

that is, replace that by nothing, so remove it, then I was thinking I am also removing the final leaving $line = to the name but...I dont think I am doing well. i only saw regex 10 years ago for two weeks and re-took it today... Any help would be strongly appreciated. regards

</code>