[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] REgular Expression for IP address



At 17.04 +0000 2000.02.13, Bart Lateur wrote:
>On Sun, 13 Feb 2000 14:17:37 GMT, Bart Lateur wrote:
>
>>If you want alternative delimiters, prefix the pattern with "m".
>>
>>  @IPN = split m|\.|, $1;   # m|PATTERN|
>
>I just thought of the following perverse variation:
>
>
>     @IPN = split m"\.", $1;
>
>It uses '"' as delimiters, but thanks to the "m" prefix, it still is a
>pattern, and parsed as a pattern. Therefore, it needs just one
>backslash.


   @IPN = split m.[\.]., $1;

This only works because . in a class does not need to be backslashed.

   @IPN = split m m\.m, $1;

This is just a variation on my favorite perl oddity:

   $_ = 'I need my massages';
   s rarer;
   print;

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org