Skip to content

Commit

Permalink
Simpler regex
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Robert Lloyd committed May 26, 2014
1 parent 10e79d7 commit ce6f77f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/typogruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def caps(text)
t.gsub(%r{
(<[^/][^>]*?>)| # Ignore any opening tag, so we don't mess up attribute values
(\s|&nbsp;|^|'|"|>|) # Make sure our capture is preceded by whitespace or quotes
([A-Z\d](?:[\.'&]?(&amp;|&\#38;)?[A-Z\d][\.']?){1,}) # Capture capital words, with optional dots, numbers or ampersands in between
([A-Z\d](?:(\.|'|&|&amp;|&\#38;)?[A-Z\d][\.']?){1,}) # Capture capital words, with optional dots, numbers or ampersands in between
(?!\w) # ...which must not be followed by a word character.
}x) do |str|
tag, before, caps = $1, $2, $3
Expand Down

0 comments on commit ce6f77f

Please sign in to comment.