ericwbailey / millennials-to-snake-people

🐍 Chrome extension that replaces occurrences of 'Millennials' with 'Snake People'
https://chrome.google.com/webstore/detail/millennials-to-snake-peop/jhkibealmjkbkafogihpeidfcgnigmlf
Do What The F*ck You Want To Public License
194 stars 115 forks source link

Do not replace 'tween #23

Closed AGSPhoenix closed 7 years ago

AGSPhoenix commented 7 years ago

'Tween is incorrectly replaced. Doesn't affect most text on the web, but I recently read a short story with a character from the American South, and it got pretty butchered.

This patch uses a technique I stoleborrowed from this post on SE. It uses a clever regex to capture the ' and change the replacement output depending on whether it was detected.

I used the following as my test suite and it properly handles them all:

tween
tweens
between
tweener
trouble 'tween the two
Those tweens are ruining everything

If you have any questions or comments, fire away.

ericwbailey commented 7 years ago

Nice catch, thank you. Mind updating to fix the conflicts? I'll get it right in after.

AGSPhoenix commented 7 years ago

Not sure if Github notifies when commits are added to a PR. In case it doesn't, poke.

ericwbailey commented 7 years ago

Ha, thanks!