Joshua Colson wrote:
> On Wed, 2006-06-07 at 16:20 -0600, Jeremy Vinding wrote:
>>Joshua Colson wrote:
>>>print $3 if $date =~ m{(Wed)\s(Jun)\s{1,2}([1..31])};
>>>
>>I believe you'd have to use alternation.
>>
>>for example, something like:
>>/(0?[1-9]|[12][0-9]|3[01])/
>>or
>>/([012]?[1-9]|[1-3]0|31)/
>
> That does work. However, I was hoping for something a little more
> concise. Such as:
>
> ...SNIP...
>
> my $pattern = join("|", reverse 1..31);
>
> my $string = '15 18 50 1 0 45 12 22';
>
> print $1, "\n" while( $string =~ m/\D($pattern)\D/g );
print "$_\n" for grep $_ >= 1 && $_ <= 31, $string =~ /\d+/g;
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>