use strict; use warnings; my $text; while ( my $text = <DATA> ) { # match a word that contain 'ou' or # if ( $text =~ m/(ou)|(#)$/ ) { $text =~ s{[/\\]}{-}g; print $text; } } __DATA__ hello.world# world\tour Game.started
That replaces the \ and the / with -. You can add the rest.
UPDATE: added alternate delimiters in response to OP private msg.
In reply to Re: regex renaming
by toolic
in thread regex renaming
by ArifS
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |