in reply to Re: regexp pattern match help?
in thread regexp pattern match help?
I decided to use split to accomplish what I wanted but for some reason on each string the length only ends up being 5 so the first 5 characters of the commented strings gets colored. How can I color the whole comment once the comment character is found. Oh and am I searching for the comment symbol the best way using the "B"?my $word = '#'; my $next = "1.0"; while (my $from = $t->search(-regexp, "\\B$word\\B", $next +, "end")) { my @comment = split(/#/, $_); #print "\$comment[0] equals ",$comment[0],"\n"; #print "\$comment[1] equals ",$comment[1],"\n"; if ($comment[1]) { my $word_len = length $comment[1] + length $word; }else{ my $word_len = length $comment[0] + length $word; } print $word; print $word_len; $next = "$from + $word_len chars"; $t->tagAdd("orange", $from, $next); $t->tagAdd("bold", $from, $next); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: regexp pattern match help?
by ysth (Canon) on Dec 03, 2003 at 07:35 UTC |