![]() |
How to replace a variable string within /* variable_string */ with x for each character in string?
How to replace a variable string within /* variable_string */ with x
for each character in string? The string may span on multiple lines. for eaxmple: /* string */ -> /* xxxxxx */ /* stringstring */ -> /* xxxxxxxxxxxx */ /* string1 string2 */ -> /* xxxxxxx xxxxxxx */ Thanks, Victor |
Re: How to replace a variable string within /* variable_string */ with x for each character in string?
X-Ftn-To: Victor
gvictor97@yahoo.com (Victor) wrote: >How to replace a variable string within /* variable_string */ with x >for each character in string? > >The string may span on multiple lines. > >for eaxmple: > >/* string */ -> >/* xxxxxx */ > >/* stringstring */ -> >/* xxxxxxxxxxxx */ > >/* string1 > string2 >*/ -> > >/* xxxxxxx > xxxxxxx >*/ $code =~ s{/\*(.+?)\*/}{ (my $com = $1) =~ s/\S/x/g; "/*$com*/"; }ges; -- Matija |
Re: How to replace a variable string within /* variable_string */ with x for each character in string?
Thanks Matija your help.
--Victor Abigail <abigail@abigail.nl> wrote in message news:<slrnbm1u0o.6v3.abigail@alexandra.abigail.nl> ... > Victor (gvictor97@yahoo.com) wrote on MMMDCLXIII September MCMXCIII in > <URL:news:ab759f.0309111049.48aafe05@posting.googl e.com>: > ^^ How to replace a variable string within /* variable_string */ with x > ^^ for each character in string? > ^^ > ^^ The string may span on multiple lines. > ^^ > ^^ for eaxmple: > ^^ > ^^ /* string */ -> > ^^ /* xxxxxx */ > ^^ > ^^ /* stringstring */ -> > ^^ /* xxxxxxxxxxxx */ > ^^ > ^^ /* string1 > ^^ string2 > ^^ */ -> > ^^ > ^^ /* xxxxxxx > ^^ xxxxxxx > ^^ */ > > > use Regexp::Common; > > $str =~ s{$RE{comment}{C}{-keep}}{my $x = $3; $x =~ s!\S!x!g; "/*$x*/"}ge; > > > Abigail |
Re: How to replace a variable string within /* variable_string */ with x for each character in string?
Thanks Matija for your help.
--V Matija Papec <mpapec@yahoo.com> wrote in message news:<16j1mvoj9dvddd3ehdovma1ke10hnn3o0m@4ax.com>. .. > X-Ftn-To: Victor > > gvictor97@yahoo.com (Victor) wrote: > >How to replace a variable string within /* variable_string */ with x > >for each character in string? > > > >The string may span on multiple lines. > > > >for eaxmple: > > > >/* string */ -> > >/* xxxxxx */ > > > >/* stringstring */ -> > >/* xxxxxxxxxxxx */ > > > >/* string1 > > string2 > >*/ -> > > > >/* xxxxxxx > > xxxxxxx > >*/ > > $code =~ s{/\*(.+?)\*/}{ > (my $com = $1) =~ s/\S/x/g; > "/*$com*/"; > }ges; |
| All times are GMT. The time now is 03:52 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.