Ian Marlier wrote:
Hi, all --
Howdy,
I'm in the process of writing a script to migrate from one wiki package to another.
The old wiki help articles in a series of flat text files. The new one holds everything in MySQL, so I need to parse the text files into a single SQL import script. I've got most of it, but there's one place where I'm getting stuck and could use some help.
The old wiki holds links in one of these formats: [WikiLink] Or [Text That Links|WikiLink] Or [Text That Links|http://someurl.com/]
The new one holds them in the form ((WikiLink)) Or ((WikiLink|Text That Links)) Or ((http://someurl.com/|Text That Links))
Replacing the individual characters is easy.
But how can I grab the "link" and "text" parts out (IF there is a "|" in the middle), and reverse them?
How about something like this: $line = '[Text That Links|http://someurl.com/]'; $line =~ s/\[([^\|]*)\|([^\]]*)\]/(($2\|$1))/ if $line =~ m/\|/;; print "$line\n";
HTH :)
Lee.M JupiterHost.Net
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>