I'm currently trying to convert wikitext table to HTML. (Parsoid isn't an option)
The tables are written in the below format. I want to regex the code for speed but I need a method to capture text between common search terms.
{| class=\"wikitable\"
|-
|'''Ruler'''
|'''Stopwatch'''
|'''Magnifying Glass'''
|-
|[[File:Ruler30cmDiagonal.png|center|200px]]
|[[File:Stopwatch.png|center|200px]]
|[[File:MagnifyingGlass.png|center|200px]]
|-
|A ruler is a piece of '''equipment''' used to measure length.
|A scientist came '''equip''' with a [[stopwatch]].
|A magnifying glass is a useful piece of '''equipment''' for looking at very small things.
|}
From the below I need to match the text between the '|-' substrings and finishing with the '|}'
So the matches will be
|'''Ruler'''
|'''Stopwatch'''
|'''Magnifying Glass'''
and
|A ruler is a piece of '''equipment''' used to measure length.
|A scientist came '''equip''' with a [[stopwatch]].
|A magnifying glass is a useful piece of '''equipment''' for looking at very small things.
and
|[[File:Ruler30cmDiagonal.png|center|200px]]
|[[File:Stopwatch.png|center|200px]]
|[[File:MagnifyingGlass.png|center|200px]]
As you can see there will be complications of missing the '|' character to matching needs to be done by character pairs. (I will also need to match by '\n|' on a later match/replace call)
Spent a good few hours on this, I know I'll need to have a lookahead and lookback (with an or for |- and }). I've come up with /((?=(\|\-))[.]*)(?!(\|\-|\|\}))/mg
being the most likely candidate but no joy.
Any advice?