Originally posted by: Beau
Originally posted by: BingBongWongFooey
I dunno if I would say I like them. They serve a purpose.
A damn good purpose. IMO, they're much more elegant than just about any other string comparison method.
Hah, well I don't know if I could describe "/href\=(['\"]?)((?<=['\"]{1})[^\\1]*?|(?<=\=|)[^\s>]*)(\\1)/i" as "elegant." Regexps can get really nasty. Yeah, they are great in their own way, but they have their ups and downs like anything else. They're not some magical wand.
if $text =~ /^\s*$/
is much less elegant, IMO, than
if not len(text.strip())