Description
Given a datafile, we want to replace, inside a paragraph,
- every first ** with <B>,
- and every second ** with </B>.
- the first ** inside a paragraph must be replaced
with <B>, no matter whether the
last ** of the previous paragraph
is properly paired or not.
|
| Raw Input
|
| Desired Output
| text01 **text02** text03 **text04
text05** text06
text07 **text08** **text09
text10 **text11** text12
|
| text01 <B>text02</B> text03 <B>text04
text05</B> text06
text07 <B>text08</B> <B>text09
text10 <B>text11</B> text12
|
|
Script and Comments
Script1 [ 1] :br0
[ 2] s/\*\*//
[ 3] t br1
[ 4] b
[ 5] :br1
[ 6] s/\*\*/<\/B>/
[ 7] t br0
[ 8] n
[ 9] /^ *$/b
[10] b br1
| |