Fix #2894: Use [[:space:]] instead of \s in regexes.
This commit is contained in:
@@ -24,11 +24,9 @@ class AliasAndImplicationImporter
|
||||
end
|
||||
|
||||
def self.tokenize(text)
|
||||
text = text.dup
|
||||
text.gsub!(/^\s+/, "")
|
||||
text.gsub!(/\s+$/, "")
|
||||
text.gsub!(/ {2,}/, " ")
|
||||
text.split(/\r\n|\r|\n/).map do |line|
|
||||
line = line.gsub(/[[:space:]]+/, " ").strip
|
||||
|
||||
if line =~ /^(?:create alias|aliasing|alias) (\S+) -> (\S+)$/i
|
||||
[:create_alias, $1, $2]
|
||||
|
||||
|
||||
@@ -33,13 +33,13 @@ module GoogleBigQuery
|
||||
constraints << "updater_id = #{user_id.to_i}"
|
||||
|
||||
if added_tags
|
||||
added_tags.scan(/\S+/).each do |tag|
|
||||
added_tags.split.each do |tag|
|
||||
constraints << add_tag_condition(tag)
|
||||
end
|
||||
end
|
||||
|
||||
if removed_tags
|
||||
removed_tags.scan(/\S+/).each do |tag|
|
||||
removed_tags.split.each do |tag|
|
||||
constraints << remove_tag_condition(tag)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -22,7 +22,7 @@ module PostSets
|
||||
end
|
||||
|
||||
def unordered_tag_array
|
||||
tag_array.reject{|tag| tag =~ /\Aorder:\S+/}
|
||||
tag_array.reject {|tag| tag =~ /\Aorder:/i }
|
||||
end
|
||||
|
||||
def has_wiki?
|
||||
@@ -55,7 +55,7 @@ module PostSets
|
||||
end
|
||||
|
||||
def pool_name
|
||||
tag_string.match(/^(?:ord)?pool:(\S+)$/i).try(:[], 1)
|
||||
@pool_name ||= Tag.has_metatag?(tag_array, :ordpool, :pool)
|
||||
end
|
||||
|
||||
def has_pool?
|
||||
@@ -67,7 +67,7 @@ module PostSets
|
||||
end
|
||||
|
||||
def favgroup_name
|
||||
tag_string.match(/^favgroup:(\S+)$/i).try(:[], 1)
|
||||
@favgroup_name ||= Tag.has_metatag?(tag_array, :favgroup)
|
||||
end
|
||||
|
||||
def has_favgroup?
|
||||
|
||||
@@ -27,7 +27,7 @@ class RelatedTagCalculator
|
||||
CurrentUser.without_safe_mode do
|
||||
Post.with_timeout(5_000, [], {:tags => tag}) do
|
||||
Post.tag_match(tag).limit(400).reorder("posts.md5").pluck(:tag_string).each do |tag_string|
|
||||
tag_string.scan(/\S+/).each do |tag|
|
||||
tag_string.split.each do |tag|
|
||||
counts[tag] += 1
|
||||
end
|
||||
end
|
||||
|
||||
@@ -96,7 +96,7 @@ private
|
||||
if (cookies[:favorite_tags].blank? || cookies[:favorite_tags_with_categories].blank?) && CurrentUser.user.favorite_tags.present?
|
||||
favorite_tags = CurrentUser.user.favorite_tags.slice(0, 1024)
|
||||
cookies[:favorite_tags] = favorite_tags
|
||||
cookies[:favorite_tags_with_categories] = Tag.categories_for(favorite_tags.scan(/\S+/)).to_a.flatten.join(" ")
|
||||
cookies[:favorite_tags_with_categories] = Tag.categories_for(favorite_tags.split(/[[:space:]]+/)).to_a.flatten.join(" ")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user