diff --git a/lib/cucumber/formatter/html.rb b/lib/cucumber/formatter/html.rb
index 708ccaea31..a0523d324e 100644
--- a/lib/cucumber/formatter/html.rb
+++ b/lib/cucumber/formatter/html.rb
@@ -562,7 +562,7 @@ def format_exception(exception)
end
def backtrace_line(line)
- line.gsub(/\A([^:]*\.(?:rb|feature|haml)):(\d*).*\z/) do
+ line.gsub(/^([^:]*\.(?:rb|feature|haml)):(\d*).*$/) do
if ENV['TM_PROJECT_DIRECTORY']
"#{$1}:#{$2} "
else