Merge pull request #292 from github/regexp_slash_az

Don't parse `\A` and `\Z` as `RegExpConstant`
This commit is contained in:
Nick Rolfe
2021-09-17 16:42:13 +01:00
committed by GitHub
4 changed files with 24 additions and 17 deletions

View File

@@ -33,7 +33,10 @@ class FooController < ActionController::Base
# GOOD - guarded by a string length check
if name.length < 1024
name.gsub regex, ''
name.gsub regex, ''
end
# GOOD - regex does not suffer from polynomial backtracking (regression test)
params[:foo] =~ /\A[bc].*\Z/
end
end
end