bradcathey has asked for the wisdom of the Perl Monks concerning the following question:
Added after posting In summary, it's a regular expression that asks for at least one of a character class, but can also have some from another class.#!/usr/bin/perl -w use strict; my $number = "..2314-1234123."; if ($number =~ /^((?:[0-9\.-]*)(?:[0-9]+)(?:[0-9\.-]*))$/) { print "$1\n"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Golf this reg ex
by davido (Cardinal) on Apr 16, 2004 at 02:04 UTC | |
by Abigail-II (Bishop) on Apr 16, 2004 at 09:59 UTC | |
Re: Golf this reg ex
by Abigail-II (Bishop) on Apr 16, 2004 at 09:44 UTC | |
Re: Golf this reg ex
by Enlil (Parson) on Apr 16, 2004 at 02:34 UTC | |
Re: Golf this reg ex
by duff (Parson) on Apr 16, 2004 at 03:03 UTC | |
Re: Golf this reg ex
by japhy (Canon) on Apr 16, 2004 at 05:18 UTC | |
by bradcathey (Prior) on Apr 16, 2004 at 13:43 UTC | |
by halley (Prior) on Apr 16, 2004 at 14:01 UTC | |
Re: Golf this reg ex
by pbeckingham (Parson) on Apr 16, 2004 at 01:56 UTC |