Optimize some regex matching (#15528)
* Use Regex#match? * Replace =~ too * Avoid to call match? from Nil * Keep value of Regexp.last_match
This commit is contained in:
		@@ -222,7 +222,7 @@ class Formatter
 | 
			
		||||
 | 
			
		||||
    escaped = text.chars.map do |c|
 | 
			
		||||
      output = begin
 | 
			
		||||
        if c.ord.to_s(16).length > 2 && UNICODE_ESCAPE_BLACKLIST_RE.match(c).nil?
 | 
			
		||||
        if c.ord.to_s(16).length > 2 && !UNICODE_ESCAPE_BLACKLIST_RE.match?(c)
 | 
			
		||||
          CGI.escape(c)
 | 
			
		||||
        else
 | 
			
		||||
          c
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user