From 42ca13a9947a57e37b0498bc96da2b66ec14864e Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Thu, 28 Feb 2019 14:00:34 -0800 Subject: Removes unnecessary dot in regexp A string S matches ([.]|\b)html if an only if matches \bhtml: * If S matches [.]html, then it matches \bhtml. * If S matches \bhtml, then it matches \bhtml. Reciprocally: * If S matches \bhtml, then it matches ([.]|\b)html. The character class can be removed, and since we are on it we remove the group too so that it is clear to a reader of the code that there is no grouping going on. References #35166. --- actionview/lib/action_view/helpers/translation_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionview/lib/action_view/helpers/translation_helper.rb') diff --git a/actionview/lib/action_view/helpers/translation_helper.rb b/actionview/lib/action_view/helpers/translation_helper.rb index 67c86592b9..8289c806ee 100644 --- a/actionview/lib/action_view/helpers/translation_helper.rb +++ b/actionview/lib/action_view/helpers/translation_helper.rb @@ -138,7 +138,7 @@ module ActionView end def html_safe_translation_key?(key) - /([_.]|\b)html\z/.match?(key.to_s) + /(?:_|\b)html\z/.match?(key.to_s) end end end -- cgit v1.2.3