Version française
Home     About     Download     Resources     Contact us    
Browse thread
regexp bug?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Hal Daume III <hdaume@I...>
Subject: Re: [Caml-list] regexp bug?
Why not?  ord('_') is 95, which is between ord('A') = 65 and ord('z'), 
which is 122.  OTOH, it is not between ord('A') = 65 and ord('Z') = 90 OR 
ord('a') = 97 and ord('z') = 122.

the first regexp matches anything in the set
  {a} union {Z} union {everything between A and z}

while the second matches anything in the set
  {everything between a and z} union {everything between A and Z}

On Tue, 3 May 2005, Eliot Handelman wrote:

> This doesn't seem right:
> 
> 
>         Objective Caml version 3.08.0
> open Str
> 
> let search r str =
>   search_forward (regexp r) str 0;
>   matched_string str;;
>  
> # search "[aA-zZ]+" "_test";;
> - : string = "_test"
> 
> whereas:
> 
> # search "[a-zA-Z]+" "_test";;
> - : string = "test"
> 
> 
> -- eliot
> 
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
> 

-- 
 Hal Daume III                                   | hdaume@isi.edu
 "Arrest this man, he talks in maths."           | www.isi.edu/~hdaume