Thread Regular Expression auf Zeile anwenden (1 answers)
Opened by Gast at 2007-02-27 08:52

renee
 2007-02-27 09:34
#74624 #74624
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Das hier ist eine Lösung:
Code: (dl )
1
2
3
4
5
6
7
8
9
#!/usr/bin/perl

use strict;
use warnings;
use Data::Dumper;

my $string = 'Test1 Test2 Test3 "Test 4" Test5';
my @words = grep{ defined $_ and $_ ne q{} }($string =~ /\s*"(.*?)"\s*|\s*(\S*)\s*/g);
print Dumper(\@words);
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 Regular Expression auf Zeile anwenden