Welcome Guest!
 Previous Message All Messages Next Message 
Re: /i resets $1 on failed matches?  Andy Lester
 Jul 11, 2004 21:11 PDT 

 This is the answer I sent in:
cat b.txt |
     perl -ne '/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/i;
              print "$1\n" if $1;'

Don't use $1 to tell if the regex matched. Instead, do

/...whatever../ and print "$1\n";


Andy Lester => an-@petdance.com => www.petdance.com => AIM:petdance
 Previous Message All Messages Next Message 
  Check It Out!

  Topica Channels
 Best of Topica
 Art & Design
 Books, Movies & TV
 Food & Drink
 Health & Fitness
 News & Information
 Personal Finance
 Personal Technology
 Small Business
 Travel & Leisure
 Women & Family

  Start Your Own List!
Email lists are great for debating issues or publishing your views.
Start a List Today!

© 2001 Topica Inc. TFMB
Concerned about privacy? Topica is TrustE certified.
See our Privacy Policy.