Thread wie ein array[0] nochmals aufspalten? (7 answers)
Opened by zieglerch at 2006-06-05 03:29

renee
 2006-06-05 13:47
#66999 #66999
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
CPAN:YAPE::Regex::Expression ist immer ganz gut, wenn man sich RegExes erklären lassen will:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
The regular expression:

(?-imsx:.*?(\d+)$)

matches as follows:

NODE EXPLANATION
----------------------------------------------------------------------
(?-imsx: group, but do not capture (case-sensitive)
(with ^ and $ matching normally) (with . not
matching \n) (matching whitespace and #
normally):
----------------------------------------------------------------------
.*? any character except \n (0 or more times
(matching the least amount possible))
----------------------------------------------------------------------
( group and capture to \1:
----------------------------------------------------------------------
\d+ digits (0-9) (1 or more times (matching
the most amount possible))
----------------------------------------------------------------------
) end of \1
----------------------------------------------------------------------
$ before an optional \n, and the end of the
string
----------------------------------------------------------------------
) end of grouping
----------------------------------------------------------------------


Außerdem solltest Du die substitution auf ein einzelnes Element machen, denn CPAN:warnings gibt Dir folgende Meldung:
Code: (dl )
Applying substitution (s///) to @array will act on scalar(@array) at skript.pl line 9.


Mehr zu dem was s/// macht findest Du in perlop.

Was $1 ist, wird in perlvar erklärt.
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 wie ein array[0] nochmals aufspalten?