You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 429 Reporter: administrator Status: closed Resolution: not a bug Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
Str.search_forward (Str.regexp_string "a") "a" 0;;
: int = 0
Str.search_forward (Str.regexp_string "a*") "a" 0;;
Uncaught exception: Not_found.
Str.search_forward (Str.regexp_string "[a-z]*") "a" 0;;
Uncaught exception: Not_found.
Str.search_forward (Str.regexp_string "[a-z]+") "a" 0;;
Uncaught exception: Not_found.
Str.search_forward (Str.regexp_string "a+") "a" 0;;
Uncaught exception: Not_found.
I think that using Str.regexp rather than Str.regexp_string will what
you expected.
Str.regexp_string creates a reg. exp. matching exactly the given string.
Str.regexp creates a reg. exp. as you defined in the string in
parameter.
Objective Caml version 3.01
Str.search_forward (Str.regexp "a") "a" 0;;
: int = 0
Str.search_forward (Str.regexp "a*") "a" 0;;
: int = 0
Str.search_forward (Str.regexp "[a-z]*") "a" 0;;
: int = 0
Str.search_forward (Str.regexp "[a-z]+") "a" 0;;
: int = 0
Str.search_forward (Str.regexp "a+") "a" 0;;
: int = 0
--
Maxence Guesdon
The text was updated successfully, but these errors were encountered:
Original bug ID: 429
Reporter: administrator
Status: closed
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
mattias.waldau@abc.se a écrit :
I think that using Str.regexp rather than Str.regexp_string will what
you expected.
Str.regexp_string creates a reg. exp. matching exactly the given string.
Str.regexp creates a reg. exp. as you defined in the string in
parameter.
Str.search_forward (Str.regexp "a") "a" 0;;
Str.search_forward (Str.regexp "a*") "a" 0;;
Str.search_forward (Str.regexp "[a-z]*") "a" 0;;
Str.search_forward (Str.regexp "[a-z]+") "a" 0;;
Str.search_forward (Str.regexp "a+") "a" 0;;
--
Maxence Guesdon
The text was updated successfully, but these errors were encountered: