[quote=jubei,25.07.2007, 21:23]eine ip adresse kannst du (im einfachsten fall) mit
\s(?:\d{1,3}\.){3}\d{1,3}\s
matchen.[/quote]
naja, oder man gewinnt 1.000.000.000 Euro im Lotto oder so.
[quote=jubei,25.07.2007, 21:23]den ausschluss, ob auch wirklich alle werte größer 0 und kleiner 256 sind, würde ich perönlich nachher machen.[/quote]
na komm, sei net so faul :) wenn du schon eine Regex einsetzt, dann
schreib doch eine, die genau das matched was du brauchst. dann musst
du dir auch nicht die Mühe machen und nachher nochmal prüfen ob die
einzelnen Oktets richtig sind :)
my $octet = q/(?:25[0-5]|2[0-4][0-9]|[0-1]?[0-9]{1,2})/;
my $ipaddr = qr/^($octet\.$octet\.$octet\.$octet)\z/;
my $ports = qr/^(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[0-5]?[0-9]{4}|[0-9]{2,4}|[1-9])\z/;
\n\n
<!--EDIT|opi|1185436578-->
What is a good module? That's hard to say.
What is good code? That's also hard to say.
One man's Thing of Beauty is another's man's Evil Hack.