How to replace a variable string within /* variable_string */ with x for each character in string?

V

Victor

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
 
M

Matija Papec

X-Ftn-To: Victor

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;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top