data-docAttribution="Rockstar Games, Inc."data-docConsumptionUri="" data-docId="com.rockstar.gta3ger" data-docTitle="Grand Theft Auto 3"data-docIconUrl="https://lh4.ggpht.com
1
2
3
4
5
data-docAttribution="Rockstar Games, Inc."
data-docConsumptionUri=""
data-docId="com.rockstar.gta3ger"
data-docTitle="Grand Theft Auto 3"
data-docIconUrl="https://lh4.ggpht.com/"
1 2 3 4 5 6 7 8 9 10 11 12
my $data='data-docAttribution="Rockstar Games, Inc."data-docConsumptionUri=""data-docId="com.rockstar.gta3ger"data-docTitle="Grand Theft Auto 3" data-docIconUrl="https://lh4.ggpht.com/"'; my %values; while(lenght($data)) { if($data=~s/^.*?([^\s=]+)\s*=\s*"([^"]*)"\s*//s) { $values{$1}=$2; } else { last } } print $values{'data-docTitle'}."\n";
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#!/usr/bin/perl use strict; use warnings; my $file = "deinedatei.txt"; my $doctitle; open (IN, '<', "$file") || die ("Could not open $file: $!"); while (<IN>) { if (/data-docTitle=\"(Grand Theft Auto 3)\"/) { $doctitle = $1; last; } } close IN || die ("Could not close $file: $!");