in reply to Re^2: coloring patterns of an array
in thread coloring patterns of an array

If you wish to match three or more "S"s then you can use the pattern /S{3,}/ and if you wanted to match, say, three to six of them then do /S{3,6}/. If you want to replace more than one occurrence of something in a string then make your substitution global by using the g modifier. Here is a bit of code to illustrate these points. Note that I capture the "S"s that I match using parentheses, "(" and ")", then use what I captured in the substitution as $1.

$ perl -le ' -> $str = q{sfSSSfsdSSSSSseSShySSSScvbcv}; -> print $str; -> $str =~ s{(S{3,})}{<tag>$1</tag>}g; -> print $str;' sfSSSfsdSSSSSseSShySSSScvbcv sf<tag>SSS</tag>fsd<tag>SSSSS</tag>seSShy<tag>SSSS</tag>cvbcv $

To look at previous nodes you have written go to your home node (you will see a "Tony1" link at the top of each page in the Monastery) and on that page you will see a link with the label "Writeups" next to it; click that and you will see all of your previous nodes.

I hope this helps you.

Cheers,

JohnGG

Update: Fixed typos.