Anno anno at shroomery.org
Thu Feb 9 09:56:15 CST 2006

```I fugured it out. I wrote a ROS Pattern
http://www.pmwiki.org/wiki/Cookbook/ROSPatterns

That goes like this:

\$ROSPatterns["/\\[{2}([^\/|\\[\\]]*?)(\/){0,1}([^\/|\\[\\]]*?)\\.
([^|\\]\\[]*?)\\]{2}/i"] =
"[[\$1\$2\$3 \$4|\$3. \$4]]";

The explanation of the pattern:

Match the character "[" literally «\[{2}»
Exactly 2 times «{2}»
Match the regular expression below and capture its match into
backreference number 1 «([^/|\[\]]*?)»
Match a single character NOT present in the list below «[^/|\[\]]*?»
Between zero and unlimited times, as few times as possible,
expanding as needed (lazy) «*?»
One of the characters "/|" «/|»
A [ character «\[»
A ] character «\]»
Match the regular expression below and capture its match into
backreference number 2 «(/){0,1}»
Between zero and one times, as many times as possible, giving back
as needed (greedy) «{0,1}»
Match the character "/" literally «/»
Match the regular expression below and capture its match into
backreference number 3 «([^/|\[\]]*?)»
Match a single character NOT present in the list below «[^/|\[\]]*?»
Between zero and unlimited times, as few times as possible,
expanding as needed (lazy) «*?»
One of the characters "/|" «/|»
A [ character «\[»
A ] character «\]»
Match the character "." literally «\.»
Match the character " " literally « »
Match the regular expression below and capture its match into
backreference number 4 «([^|\]\[]*?)»
Match a single character NOT present in the list below «[^|\]\[]*?»
Between zero and unlimited times, as few times as possible,
expanding as needed (lazy) «*?»
The character "|" «|»
A ] character «\]»
A [ character «\[»
Match the character "]" literally «\]{2}»
Exactly 2 times «{2}»

```