Thread nicht ganz so einfach Stringmanipulation (6 answers)
Opened by errorsmith at 2015-01-06 10:35

renee
 2015-01-06 14:52
#179084 #179084
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Vielleicht hilft Dir
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/perl

use strict;
use warnings;

while ( my $line = <DATA> ) {
    my @candidates = $line =~ m{ "([^"]+)" }xmsg;
    my @paths      = grep{ m{/} }@candidates;

    print sprintf "found on line %s: %s\n", $., join ', ', @paths;
}

__DATA__
soundSet = { name = "bus_modern", horn = "vehicle/truck_modern/horn.wav" }
id = "vehicle/bus/citaro/lod_0_w2.msh",
"vehicle/bus/berkhof_duvedec/berkhof_duvedec_lod_0_w2.msh", "vehicle/bus/berkhof_duvedec/berkhof_duvedec_lod_0_w3.msh", 
weiter

Ausgabe
Code: (dl )
1
2
3
4
$ perl paths.pl 
found on line 1: vehicle/truck_modern/horn.wav
found on line 2: vehicle/bus/citaro/lod_0_w2.msh
found on line 3: vehicle/bus/berkhof_duvedec/berkhof_duvedec_lod_0_w2.msh, vehicle/bus/berkhof_duvedec/berkhof_duvedec_lod_0_w3.msh
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread nicht ganz so einfach Stringmanipulation