Thread regex: sich wiederholende zeichen ermitteln (12 answers)
Opened by Froschpopo at 2006-03-07 00:39

Linuxer
 2006-03-22 21:27
#63518 #63518
User since
2006-01-27
3875 Artikel
HausmeisterIn

user image
Der erste Ansatz mit {,3} war schon nicht ganz verkehrt... .s.u.

Code (perl): (dl )
$text =~ m/(?:.+){3,}/ ;


Sollte auf einen beliebigen String passen, der sich mindestens 3mal wiederholt.

Alle drei Perldocs zum Thema RegEx sind interessant zum Thema RegEx ;o)
perldoc perlretut
perldoc perlrequick
perldoc perlre

[edit]
Z.B. aus http://perldoc.perl.org/perlre.html ; Stichwort Quantifier:
Quote
The following standard quantifiers are recognized: metacharacter quantifier * + ? {n} {n,} {n,m}

* Match 0 or more times
+ Match 1 or more times
? Match 1 or 0 times
{n} Match exactly n times
{n,} Match at least n times
{n,m} Match at least n but not more than m times

[/edit]\n\n

<!--EDIT|Linuxer|1143055861-->
meine Beiträge: I.d.R. alle Angaben ohne Gewähr und auf Linux abgestimmt!
Die Sprache heisst Perl, nicht PERL. - Bitte Crossposts als solche kenntlich machen!

View full thread regex: sich wiederholende zeichen ermitteln