es gibt da ein nettes perl-modul, mit dem man sich regexes erklären lassen kann. das sieht dann so aus:
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
perl -wle'use YAPE::Regex::Explain;
my $re = qr/\W*(\w+\W+){1,2}\w+\W*/;
print YAPE::Regex::Explain->new($re)->explain;'
The regular expression:
(?-imsx:\W*(\w+\W+){1,2}\w+\W*)
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):
----------------------------------------------------------------------
  \W*                      non-word characters (all but a-z, A-Z, 0-
                           9, _) (0 or more times (matching the most
                           amount possible))
----------------------------------------------------------------------
  (                        group and capture to \1 (between 1 and 2
                           times (matching the most amount
                           possible)):
----------------------------------------------------------------------
    \w+                      word characters (a-z, A-Z, 0-9, _) (1 or
                             more times (matching the most amount
                             possible))
----------------------------------------------------------------------
    \W+                      non-word characters (all but a-z, A-Z,
                             0-9, _) (1 or more times (matching the
                             most amount possible))
----------------------------------------------------------------------
  ){1,2}                   end of \1 (NOTE: because you are using a
                           quantifier on this capture, only the LAST
                           repetition of the captured pattern will be
                           stored in \1)
----------------------------------------------------------------------
  \w+                      word characters (a-z, A-Z, 0-9, _) (1 or
                           more times (matching the most amount
                           possible))
----------------------------------------------------------------------
  \W*                      non-word characters (all but a-z, A-Z, 0-
                           9, _) (0 or more times (matching the most
                           amount possible))
----------------------------------------------------------------------
)                        end of grouping
----------------------------------------------------------------------