Re: Pattern matching
- Posted by matthewwalkerlewis at yahoo.com Apr 15, 2004
- 514 views
> I need to find IP in a string. > Using wildcard_match() in wildcard.e > i.e wildcard_match("*.*.*.*", string) only return true or false. > I want it to return position and if possible test if it is legal. You could try tokenizing the string on '.' and checking the number of fields. You could use Kat's strtok.e for this: http://www.tiggrbox.info/program/strtok-v2-1.html There are also some regular expression libraries in the archives that could probably be used. Something like: /^(\d+\.){3}\d+$/ should work (assuming Perl-compatible regexp). Matt Lewis