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

Str.string_match incorrect #3395

Closed
vicuna opened this issue Dec 22, 2004 · 1 comment
Closed

Str.string_match incorrect #3395

vicuna opened this issue Dec 22, 2004 · 1 comment
Labels

Comments

@vicuna
Copy link

vicuna commented Dec 22, 2004

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

Bug description

Full_Name: John Skaller
Version: 3.0.8.1
OS: linux
Submission from: ppp194-89.lns1.syd2.internode.on.net (203.122.194.89)

let m = Str.regexp "a";;
let b = Str.string_match m "aa" 0;;

print_endline (if b then "YES" else "NO");;

prints YES. Clearly the string "aa" is NOT matched by
the regexp "a".

This would be the correct result for the

Str.string_partial_match

function which matches prefixes. However Str.string_match
should match the whole string or return false.

[This problem arose using Str.string_match to find
filenames with extension .mli .. it picked up
files that didn't end in .mli .. I worked around it
using $, but that will not suffice if the string
contains newlines]

@vicuna
Copy link
Author

vicuna commented Mar 10, 2005

Comment author: administrator

The behavior is as intended (anchored match of prefix). The documentation is
ambiguous and should be improved.

Doc fixed DD 2005-03-10

@vicuna vicuna closed this as completed Mar 10, 2005
@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