Matching numbers at the beginning of a string?
| Newsgroups | gmane.comp.lang.ocaml.beginners |
|---|---|
| Message-ID | <[email protected]> |
I was expecting a true while trying to match 6 numbers from the beginning of string, instead i am getting a false.
What is wrong with this regular expression?
utop # Str.string_match (Str.regexp "^\\d{6}") "122323" 0 ;;
- : bool = false
The following works, but that is not exactly i am looking for.
utop # Str.string_match (Str.regexp "^[0-9]+") "122323" 0 ;;
- : bool = true
Cheers.
- jo