Saturday, 24 August 2013

ruby regular expression is not working as expected

ruby regular expression is not working as expected

s=%q( I'm good boy 'girl "good" boy')
p=/(['"])([^\1]*)(\1)/
p=~s
$& => "'m good boy 'girl \"good\" boy'"
I think the result is wrong

No comments:

Post a Comment