[pmwiki-users] ROSPatterns/regex question

James DeVain jamesdevain at mail.com
Tue Sep 26 11:44:58 CDT 2017


I've been trying to use $ROSPatterns to change something like this:

" mary had a little lamb"

into this:


I don't have much experience with regex, but what I have so far is:

$ROSPatterns ["/^\\s/"]    = "(:w1:";

which places the first "(:word_1:" in front of "mary". Now I need to find the second empty
space and change it to ":)(:word_2:". I figured I could just write a different ROSPattern
for each empty space, like:

$ROSPatterns ["/^\\s/"]    = "(:w1:";
$ROSPatterns ["...find second empty space..."]    = ":)(:w2:";
$ROSPatterns ["...find third empty space..."]    = ":)(:w3:";
... etc.

Everything I've tried either erases everything after the second space, replaces EVERYTHING
with ":)(:word_2:", has no effect at all, or some other unexpected result.

I realize that this is more of a regex question than a PmWiki question, but if anybody could
help me with this I would be very grateful.


More information about the pmwiki-users mailing list