"character class ""bug"" 
Author Message
 "character class ""bug""


 Date: Mon, 11 Sep 1995 00:35:52 GMT

  Guess what, [.\n] doesn't catch all characters.  Try running this

  #!/usr/bin/perl
  $test = "I am a test";

  # This fails on perl 4 & 5
  if ($test=~/[.\n]+/) {print "ok match\n";};

I don't see either of the litteral characters "." or "\n" in the test string.
The [] character class construct has "different" rules --- the only "special"
characters are "^" if used in the first position and "-" to specify a
range.  Look again at the pod for regular expressions (perlre).
maybe what you wanted is /(.|\n)+/ ???

--
Les Troyer
Sr. Analyst
Siemens Power Corp
2101 Horn Rapids Rd.
Richland, Wa. 99352-0130

Voice    (509) 375-8695
Fax      (509) 375-8402
Operator (509) 375-8100

Ad Hoc, Ad Loc, Quid Pro Quo; So Little Time SO Much To Know.
   -Jeromy Hillery Dillery Boo, PHD, MS and Q

/GCS/E d? s:+ a C+ ULUH*++++$ P+++>++++ L+++ E--- W N++ K? w++ O M- V--
 !PS !PE Y-- PGP? t 5? X? R- tv- b+++ DI+++ D? G e++ h---- r+++ y?



Fri, 27 Feb 1998 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. system(("cp", "-Rf", "/tmp/a/*", "/tmp/b")); doesnt wrk

2. how to parse a "this", "that", "and the ", "other" file

3. s"\n+$"" s"\n*$""

4. how to safely substitute a "(", ")" or "["

5. "perlfreak", "i love perl", "perllover" or...???

6. how to parse "this", "that", "other"

7. split line like "a","b","c"

8. Looking for a Solaris "quot" replacement

9. Implemenation of "Virtual Classes"

10. eval "require $class";

11. Class vars and "exists": Error in book

12. Implemenation of "Virtual Classes"

 

 
Powered by phpBB® Forum Software