From: noreply@... Date: 2005-08-09T23:17:08+09:00 Subject: [ ruby-Bugs-2218 ] String.scan Bugs item #2218, was opened at 2005-08-09 10:10 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=1698&aid=2218&group_id=426 Category: Standard Library Group: None Status: Open Resolution: None Priority: 3 Submitted By: Steve Knipe (sknipe) Assigned to: Nobody (None) Summary: String.scan Initial Comment: # PATTERN_REGEXP = /(<%=gettext\(.+?\)%>|\{\{(.+?)\}\})/m PATTERN_REGEXP = /(.*?)(<%=gettext\(.+?\)%>|\{\{(.+?)\}\})/m substr = "" File.open("/home/sknipe/rblog/templates/dtree.js", "r") do |file| file.each_line {|line| substr = substr + line.dump} end puts "Before scan" substr.scan(PATTERN_REGEXP) { pre_match = $1 inner_match = $2 puts "PRE MATCH = " + pre_match if pre_match != nil puts "INNER MATCH = " + inner_match if inner_match != nil } puts "After scan" The program functions with both regular expressions, however the performance of the second regular expression is orders of magnitude worse. Can you please suggest a viable work around or please fix the performance issue. Thanks The file contents of dtree.js is as follows: ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=1698&aid=2218&group_id=426