From: Pit Capitain Date: 2006-09-18T19:28:25+09:00 Subject: Re: Regular expression for string.anotherstring Paul Lutus schrieb: > Bart Braem wrote: >> >> I will try it with: >> string =~ /^\w+\.\w+\z/ >> >> But is there a ruby operator to look for matches on the entire string? > > string =~ /^\w+\.\w+$/ > > Must match the entire string. Because of multiline issues, where that is a > factor, you can always split on newlines in advance of this test to be sure > you are matching the entire string unambiguously. This would be unnecessarily complex. Just use Bart's regexp (with \z instead of $). It matches the entire string. Regards, Pit