Solved

Swapping link and text around.

Posted on 2000-03-06
3
163 Views
Last Modified: 2013-12-25
I have multiple lines like this:<a HREF="http://www.test.com/cgi-bin/test.pl/one" target="new">
FRI Mar 3, 00, 11:47 AM</A>
Message one two three four text goes here test1<BR>
<a HREF="http://www.test.com/cgi-bin/test.pl/two" target="new">
FRI Mar 2, 00, 09:10 AM</A>
Message two three four text goes here test2<BR>

What kind of statement or expression I need to build, if I want to swap Time and Message other way around: Message first and then time. And also I want message to be the link, and time just text?

So Output would be like this:

<a HREF="http://www.test.com/cgi-bin/test.pl/one" target="new">Message one two three four text goes here</A>FRI Mar 3, 00, 11:47 AM<BR>
<a HREF="http://www.test.com/cgi-bin/test.pl/two" target="new">Message two three four text goes here test2</A>FRI Mar 2, 00, 09:10 AM<BR>

Maybe something like this:

$news =~ s!(<.+> )(.+)(</a> )(.+)<br>!$1$4$3$2!i;

I cant this to get work? What is the problem?

Hank

0
Comment
Question by:hoster19
  • 2
3 Comments
 
LVL 2

Expert Comment

by:sanek
ID: 2588426
This will do a job:

$news = <<END_NEWS;
<a HREF="http://www.test.com/cgi-bin/test.pl/one" target="new">
FRI Mar 3, 00, 11:47 AM</A>
Message one two three four text goes here test1<BR>
<a HREF="http://www.test.com/cgi-bin/test.pl/two" target="new">
FRI Mar 2, 00, 09:10 AM</A>
Message two three four text goes here test2<BR>
END_NEWS

$news =~ s!<([^>]*?)>([^>]*?)</A>([^>]*?)<BR>!<$1>$3</A>$2<BR>!gi;

print $news;


0
 
LVL 2

Accepted Solution

by:
sanek earned 500 total points
ID: 2588430
I mean,
$news =~ s!<([^>]*?)>([^>]*?)</A>([^>]*?)<BR>!<$1>$3</A>$2<BR>!gi;
is what your search :)
0
 

Author Comment

by:hoster19
ID: 2588592
Thank You!

Check

http://www.modernmenus.com

escpesially the reverse auction!, You could earn some money there by answering questions.

Hank
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

In this tutorial I will focus on how to use WhizBase as a tool for sending ICQ messages to ICQ. Here I will use a new technology in WhizBase, published in WhizBase 5.1 version. In this tutorial I will use 3 files, pager.wbsp for the processing, e…
Making a simple AJAX shopping cart Couple years ago I made my first shopping cart, I used iframe and JavaScript, it was very good at that time, there were no sessions or AJAX, I used cookies on clients machine. Today we have more advanced techno…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now