Skip to content

Commit

Permalink
Cleanup Regexp.escape
Browse files Browse the repository at this point in the history
  • Loading branch information
adambeynon committed Jan 27, 2014
1 parent 64e0455 commit 5a14d13
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion opal/corelib/regexp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Regexp
class << self
def escape(string)
%x{
return string.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$| ]/g, '\\$&')
return string.replace(/([-[\]/{}()*+?.^$\\| ])/g, '\\$1')
.replace(/[\n]/g, '\\n')
.replace(/[\r]/g, '\\r')
.replace(/[\f]/g, '\\f')
Expand Down

0 comments on commit 5a14d13

Please sign in to comment.