|P is for Practical|
wiki regex reprocessing replacementby LanX (Cardinal)
|on Feb 15, 2020 at 14:39 UTC||Need Help??|
LanX has asked for the wisdom of the Perl Monks concerning the following question:
I need a regex to transform wiki markup surrounding words to html, * to <b> etc.
my problem is that */_ could be combined at word boundaries, see the following example
'_*one /two/*_ _*three /four/*_ _*five /six/*_' => 'one two three /four/ five six'
as you can see I have to run the tf() transformation thrice
Is there a way to make it a one-run transformation?
Trouble is that /g continues after the inserted replacement, here underline
I was experimenting with lookaround-assertions and \G and couldn't get it done.
The only ways I can (theoretically) think of so far are
I just noticed a bug, since four wasn't expanded.
&tf has to be better written with a lookbehind which doesn't consume the next whitespace
I'll update an SSCCE soon.