Skip to content

Commit

Permalink
Merge pull request #921 from bencates/master
Browse files Browse the repository at this point in the history
Clean up ugly regex to use POSIX character class
  • Loading branch information
joliss committed Jan 1, 2013
2 parents 8873f8f + 8852e4d commit 3daca9e
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions lib/capybara/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ class << self
# @return [String] Normalized text
#
def normalize_whitespace(text)
# http://en.wikipedia.org/wiki/Whitespace_character#Unicode
# We should have a better reference.
# See also http://stackoverflow.com/a/11758133/525872
text.to_s.gsub(/[\s\u0085\u00a0\u1680\u180e\u2000-\u200a\u2028\u2029\u202f\u205f\u3000]+/, ' ').strip
text.to_s.gsub(/[[:space:]]+/, ' ').strip
end

##
Expand Down

0 comments on commit 3daca9e

Please sign in to comment.