A RegEx question

From: Ian Marlier (marlieri_at_studentuniverse.com)
Date: 07/26/04


Date: Mon, 26 Jul 2004 07:56:52 -0400
To: <beginners@perl.org>

Hi, all --

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?

Any help appreciated.

Thanks,

Ian



Relevant Pages

  • Re: Apache redirection question
    ... There are various ways to get Apache to run a script ... to redirect any URL referencing a file in the root directory of ... he'd just redirect them to the wiki Welcome page. ...
    (uk.comp.sys.mac)
  • Re: A RegEx question
    ... > I'm in the process of writing a script to migrate from one wiki ... > package to another. ... > into a single SQL import script. ...
    (perl.beginners)
  • Re: [opensuse] 10.2: YOU resets /root/ permissions?
    ... if you happen to have time to do so, giving on the wiki ... a copy of your script could certainly be of interest ... I prefer to keep my custom system stuff collected under /root. ... But thank you for the suggestion. ...
    (SuSE)
  • Re: http://alu.cliki.net/ not writable?
    ... >> Probably they aren't using a browser, but a script. ... I've read the source for UseMod, and for that wiki, I think changing the ... they can still spam hundreds of unmodified UseMod wikis. ...
    (comp.lang.lisp)
  • Re: Suitcase Nuclear Weapons, Favorite Threat of Hollywood Scriptwriters, Are Probably a Myth
    ... Fred J. McCall wrote in ... :>:Flat lie Fred. ... Keep watching the thread, you stupid bastard. ... well,it sure destroys YOUR credibility;you refuse to even read the Wiki ...
    (sci.military.naval)