Skip to content

Instantly share code, notes, and snippets.

@jpr5
Created August 31, 2010 01:46
Show Gist options
  • Save jpr5/558388 to your computer and use it in GitHub Desktop.
Save jpr5/558388 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
s = "I really think this regexp engine sucks, why don't they just use PCRE?"
re = /((\w+\s*)+ regexp)$/
re.match(s)
puts "NIH, muthafuckaz, NIH!!!!!!!!" # p.s you'll never see this line
@usergenic
Copy link

["i love this regexp","this regexp sucks","this regexp sucks hard","this regexp sucks so hard","this regexp sucks so fucking bad","this regexp sucks so hard it hurts","this regexp is so fucking retarded it will shut your system down","you really dont want to run this regexp ever"].each{|s| puts s; /((\w+\s*)+ regexp)$/.match(s)}

@postmodern
Copy link

import re
s = "I really think this regexp engine sucks, why don't they just use PCRE?"
m = re.search("((\w+\s*)+ regexp)$",s)

(Hint: that's not ruby code and it runs just as slowly :))

@postmodern
Copy link

:mod +Text.Regex.Posix

let s = "I really think this regexp engine sucks, why don't they just use PCRE?"
let r = "((\\w+\\s*)+ regexp)$"
s =~ r :: Bool

(Definitely not Ruby code, but they seem to get it right.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment