[ create a new paste ] login | about

Link: http://codepad.org/02u104FU    [ raw code | output | fork ]

Perl, pasted on Oct 20:
1
2
3
4
5
6
7
8
9
10
$text = <<EOS;
<li>sdfjlsdkjflks</li>
<li>fsdfi sdjfois dosfj osid</li>
<li>sdf djfid id fidj fi</li>
<li>sdjfsi isjdifji</li>
EOS

$count = 1;
$text =~ s/<li>(.*?)<\/li>/'<li><a href="#'.$count++.'">'.$1.'<\/a><\/li>'/ge;
print($text . "\n");


Output:
1
2
3
4
5
<li><a href="#1">sdfjlsdkjflks</a></li>
<li><a href="#2">fsdfi sdjfois dosfj osid</a></li>
<li><a href="#3">sdf djfid id fidj fi</a></li>
<li><a href="#4">sdjfsi isjdifji</a></li>



Create a new paste based on this one


Comments: