Skip to content

Instantly share code, notes, and snippets.

@rpechayr
Created September 4, 2015 09:39
Show Gist options
  • Save rpechayr/8b4bef1516a6fb056228 to your computer and use it in GitHub Desktop.
Save rpechayr/8b4bef1516a6fb056228 to your computer and use it in GitHub Desktop.
Huge regex match time
bod = "![image](https://cloud.githubusercontent.com/assets/8692675/8456774/3716d8f6-20d6-11e5-8b20-e0085491c2b6.png)\r\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n--- \n**Pivotal Tracker** - [#100934594](https://www.pivotaltracker.com/story/show/100765594)\n*Estimation*: **2.0 points**\n*ETA*: **14th August 2015**\n\n--- \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
reg = /^--- (.|\n)*--- /m
hello = "hi"
bod.gsub(reg, hello)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment