Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0003778OCamlOCaml generalpublic2005-08-31 16:302005-10-12 14:58
Reporteradministrator 
Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
StatusacknowledgedResolutionopen 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0003778: \\2 in global_replace
DescriptionFull_Name: mattias waldau
Version: 3084
OS: WinXP
Submission from: c-328ae253.09-253-7570701.cust.bredbandsbolaget.se (83.226.138.50)


Got bitten by the \\2 feature of global_replace. I had code that substitute in a
string from the user into a string and it contained \\, i.e.

replace_first (String.regexp_string "{1}") "new_hire_training1\\2" txt

and of course it failed. The solution is of course to use substitute_first
instead, i.e.

substitute_first arg1_regexp (fun _ -> "new_hire_training1\\2") txt

Although this is of course a bit overkill for a simple search-replace.

Suggestion:

1. Introduce a simple search-replace function that replace a substring with
another substring without any use of regexp or templ

2. Introduce a function quote_tmpl that quotes \\ and mention it in the
documentation of global_replace and substitute_first


TagsNo tags attached.
Attached Files

- Relationships

-  Notes
There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2005-11-18 10:13 administrator New Issue


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker