- or download this
my $data = "<tag>this is a line of code</tag>
<explanation>this is where I wax poetic about my code</explanation>
<tag>this is another example of code</tag>";
if ($data =~ /<tag>(.*)<\/tag>/s) {
print "I found =>$1<=\n";
}
- or download this
I found =>this is a line of code</tag>
<explanation>this is where I wax poetic about my code</explanation>
<tag>this is another example of code<=
- or download this
if ($data =~ /<tag>(.*?)<\/tag>/s) {
print "I found =>$1<=\n";
}
- or download this
my $line = "Name: Some Soldier, Rank: Leftenant, Serial: 426879824, Boots: black"; - or download this
$line =~ /^\w*: \w*\s*\w*, \w*: \w*, \w+: (\d)*, \w*: \w*$/; - or download this
$line =~ /[Ss]erial: (\d{9})/; - or download this
$line =~ /<title>(.*?)</title>/; - or download this
$line =~ m!<title>(.*?)</title>!; - or download this
my $line = "a.b.cd*f.";
$line =~ /([^.*]{2})/;
- or download this
my $input = "foo bar baz";
$input =~ s/(\w+)/uc($1)/ge;
- or download this
$intput =~ s/([A-Za-z]+)/uc($1)/ge;