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.matched_string also takes into account the matching occuring in Str.global_substitute #4019

Closed
vicuna opened this issue May 4, 2006 · 1 comment

Comments

@vicuna
Copy link

@vicuna vicuna commented May 4, 2006

Original bug ID: 4019
Reporter: jrouquie
Status: closed (set by @damiendoligez on 2012-09-11T14:45:59Z)
Resolution: fixed
Priority: normal
Severity: text
Version: 3.09.0
Target version: 4.00.1+dev
Category: documentation
Monitored by: jrouquie

Bug description

The documentation of Str.matched_string says "matched_string s returns the substring of s that was matched by the latest Str.string_match, Str.search_forward or Str.search_backward."

It should says "matched_string s returns the substring of s that was matched by the latest Str.string_match, Str.search_forward, Str.search_backward or Str.global_substitute."

Other functions of the Str module are probably to be added to the list.

Test:

#load "str.cma"
let r = Str.regexp "\([a-z]\)\([A-Z]\)"
let subst line =
let s = Str.matched_string line in
assert (String.length s = 2);
Printf.sprintf "%c_%c" s.[0] (Char.lowercase s.[1])
;;
Str.global_substitute r subst "camlCase and caml_style"

produces:

  • : string = "caml_case and caml_style"
@vicuna
Copy link
Author

@vicuna vicuna commented Sep 11, 2012

Comment author: @damiendoligez

Fixed in 4.00.1+dev (r 12921) and trunk (r 12923).

@vicuna vicuna closed this as completed Sep 11, 2012
@vicuna vicuna added this to the 4.00.1 milestone Mar 14, 2019
@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
Projects
None yet
Development

No branches or pull requests

1 participant