<StdViol sev="3" ln="59" cat="MISRA2004" hash="-1687940199" tool="c++test" rule="MISRA2004-14_7" locType="sr" lang="cpp" msg="Provide only one exit point in 'doMount' function" auth="fsdun" locStartln="59" locStartPos="4" locEndLn="59" locEndPos="5" locFile="/optstart/dut/src/action.c"/>
/.*"(.*)".*"(.*)".*"(.*)".*"(.*)".*"(.*)".*"(.*)".*"(.*)".*"(.*)".*"(.*)".*"(.*)".*"(.*)".*"(.*)".*"(.*)".*"(.*)".*"(.*)"/
1 2 3 4 5 6 7 8 9
#!/usr/bin/perl use strict; use warnings; my $txt = q(<StdViol sev="3" ln="59" cat="MISRA2004" hash="-1687940199" tool="c++test" rule="MISRA2004-14_7" locType="sr" lang="cpp" msg="Provide only one exit point in 'doMount' function" auth="fsdun" locStartln="59" locStartPos="4" locEndLn="59" locEndPos="5" locFile="/optstart/dut/src/action.c"/>); while ($txt =~ s/"([^"]+)"//) { print "$1\n"; }
1 2 3 4 5 6 7 8 9 10 11 12 13
use strict; use warnings; my $txt = q(<StdViol sev="3" ln="59" cat="MISRA2004" hash="-1687940199" tool="c++test" rule="MISRA2004-14_7" locType="sr" lang="cpp" msg="Provide only one exit point in 'doMount' function" auth="fsdun" locStartln="59" locStartPos="4" locEndLn="59" locEndPos="5" locFile="/optstart/dut/src/action.c"/>); my @params = split '"', $txt; $params[0] =~ s/.*? //; pop @params; while (@params) { my $opt = shift @params; $opt =~ tr / =//d; my $value = shift @params; print "Option $opt hat Wert $value\n"; }
my @paare = $txt =~ /(\w+?=".+?")/g;
print join "\n", ($txt =~ /"(.+?)"/g);