Regular expressions: Difference between revisions
→{{header|Perl 6}}: added section
(+Icon+Unicon) |
(→{{header|Perl 6}}: added section) |
||
Line 599:
$string =~ s/i/u/ig; # would change "I am a string" into "u am a strung"</lang>
=={{header|Perl 6}}==
<lang perl6>use v6;
if 'a long string' ~~ /string$/ {
say "It ends with 'string'";
}
# substitution has a few nifty features
$_ = 'The quick Brown fox';
s:g:samecase/\w+/xxx/;
.say;
# output:
# Xxx xxx Xxx xxx
</lang>
=={{header|PHP}}==
|