String>>escapeRegex fails on Strings including an asterisk
By Tim Felgentreff - Posted on September 13th, 2009
| Project: | GNU Smalltalk |
| Component: | STInST |
| Category: | bug |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | fixed |
Description
gst-convert fails with "Invalid index 1: index out of range" when trying to convert methods have a '*' in their category to squeak. The reason is that since b44ebba00d36fe7a3d112811f4617f5630ee55f4 escapeRegex is called on the methodCategory.
As 'escapeRegex' should simply put backslashes in Front of regex characters, why not use a simple
String>>escapeRegex [
^ '[][?*+\\()^$|]'
inject: self
into: [:str :char |
str
copyReplaceAll: char asString
with: '\', char asString].
]
instead of the call to "copyFrom:to:replacingAllRegex:with:"? Wouldn't that solve the problem?
Updates
#1 submitted by Paolo Bonzini on Mon, 09/14/2009 - 07:40
| Status: | active | » fixed |
