From: Wesley J Landaker Date: 2002-05-03T04:18:49+09:00 Subject: Re: regexp help: contains only one tag On Thursday 02 May 2002 01:07 pm, Morris, Chris wrote: > def test_contains_only_a_tag > re = /.*<.*>.*/ > assert( ('' =~ re)) > assert(!(' assert(!('tag>' =~ re)) > assert(!('tag' =~ re)) > assert(!('' =~ re)) > assert(!(' ' =~ re)) > assert( (' < t a g > ' =~ re)) > assert(!('a' =~ re)) > end > > My re passes them all except the last one, which is the one I need > help with. Any takers? :) One other thing to note when debugging regexes: if you're not sure what the heck is going on, try a: puts $~ to see what matched. Lots of times, it's not what you expected, especially when they get complex. ;) Good luck! Hope that helps. =) -- Wesley J. Landaker - wjl@icecavern.net OpenPGP FP: C99E DF40 54F6 B625 FD48 B509 A3DE 8D79 541F F830 # (wjl@mindless.com is dead, don't use it)