On Wed, 18 Sep 2002 19:43:50 -0500, [EMAIL PROTECTED] (Martin A. Hansen) wrote:
>what do a regex look like that only matches numbers of the format > >(the length of the number doesnt matter its the . thats the problem) > >1233.1234 >or >1234 What about .1234 ? Maybe a character class? [\d+\.]+ ###################################################### #!/usr/bin/perl # @newarray will get all elements of array which match regex @array = qw(1 d 3 5 f tt 4rt 555 zz88tt 9.1 345.67 .2345); @newarray = grep{/\d+/} @array; @newarray1 = grep{/^\d+$/} @array; @newarray2 = grep {/\d+\.\d+/} @array; @newarray3 = grep {/^[\d+\.]+$/} @array; print "@array\n"; print "@newarray\n"; print "@newarray1\n"; print "@newarray2\n"; print "@newarray3\n"; ######################################################### -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]