Thread Suche erklären (RegEx) (14 answers)
Opened by Tom at 2012-04-13 10:16

Relais
 2012-04-14 11:37
#157481 #157481
User since
2003-08-06
2254 Artikel
ModeratorIn
[Homepage] [default_avatar]
Guest Tom
Hallo,

kann mir jemand die folgende Suche erklären?

Code (perl): (dl )
$inFile=~/(.+)\.([^.]+)/


Spannend, dass noch keiner CPAN:YAPE::Regex::Explain vorgeschlagen hat.

Code: (dl )
1
2
use YAPE::Regex::Explain;
my $exp = YAPE::Regex::Explain->new($REx)->explain;


Quote
The regular expression:

(?-imsx:(.+)\.([^.]+))

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):
----------------------------------------------------------------------
( group and capture to \1:
----------------------------------------------------------------------
.+ any character except \n (1 or more times
(matching the most amount possible))
----------------------------------------------------------------------
) end of \1
----------------------------------------------------------------------
\. '.'
----------------------------------------------------------------------
( group and capture to \2:
----------------------------------------------------------------------
[^.]+ any character except: '.' (1 or more
times (matching the most amount
possible))
----------------------------------------------------------------------
) end of \2
----------------------------------------------------------------------
) end of grouping
----------------------------------------------------------------------
[/quote]
Erst denken, dann posten --
27. Deutscher Perl- u. Raku -Workshop 12. bis 14. Mai 2025 in München.

Winter is Coming

View full thread Suche erklären (RegEx)