Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Difference between str library of 3.06 and 3.07 #8346

Closed
vicuna opened this issue Oct 29, 2003 · 3 comments
Closed

Difference between str library of 3.06 and 3.07 #8346

vicuna opened this issue Oct 29, 2003 · 3 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Oct 29, 2003

Original bug ID: 1903
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: Vladimir Támara Patiño
Version: 3.07
OS: OpenBSD
Submission from: gateway1-theorie.informatik.uni-kl.de (131.246.16.250)

if (Str.string_match (Str.regexp "^[ -0-9]*$") "41" 0) then
print_endline ("Here enters with Ocaml 3.06")
else
print_endline ("And here with Ocaml 3.07")

(* Works fine in both with ^[- 0-9]*$ *)

@vicuna
Copy link
Author

vicuna commented Nov 6, 2003

Comment author: administrator

Full_Name: Vladimir Támara Patiño

if (Str.string_match (Str.regexp "^[ -0-9]*$") "41" 0) then
print_endline ("Here enters with Ocaml 3.06")
else
print_endline ("And here with Ocaml 3.07")

(* Works fine in both with ^[- 0-9]*$ *)

Hello,

This is clearly a bug in 3.06, and we are glad that it is fixed in 3.07.
The O'Caml documentation refers to GNU emacs for the syntax of
regular expressions. The GNU emacs documentation specifies that
a '-' in a character set stands for itself if it is the first or last character
in the set, or if it follows a range.

Thus your regexp is parsed as:
^ (beginning of line)
[ (starting a character set)
(space)-0 (a range of characters that doesn't include 1 nor 4)

  • (one character)
    9 (one character)
    ] (ending the character set)
    $ (end of line)

Hence it should not match the string "41".

Thanks for the report,

-- Damien

@vicuna
Copy link
Author

vicuna commented Nov 6, 2003

Comment author: administrator

bug in 3.06 fixed in 3.07 -- DD 2003-06-11

@vicuna vicuna closed this as completed Nov 6, 2003
@vicuna
Copy link
Author

vicuna commented Nov 6, 2003

Comment author: administrator

On Thu, Nov 06, 2003 at 04:41:13PM +0100, Damien Doligez wrote:

Full_Name: Vladimir Támara Patiño

if (Str.string_match (Str.regexp "^[ -0-9]*$") "41" 0) then
print_endline ("Here enters with Ocaml 3.06")
else
print_endline ("And here with Ocaml 3.07")

(* Works fine in both with ^[- 0-9]*$ *)

Hello,

This is clearly a bug in 3.06, and we are glad that it is fixed in 3.07.
The O'Caml documentation refers to GNU emacs for the syntax of
regular expressions.

Ok. Thank you. Sorry I didn't read the emacs documentation.

--
Que Dios nos ilumine para hacer su voluntad. Información de dominio público.

Vladimir Támara Patiño.
http://www.geocities.com/v-tamara

@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant