Hi --

On Mon, 18 Sep 2006, Bart Braem wrote:

> MonkeeSage wrote:
>
>> I.e., you were matching on either side of the @
>>
> Oh boy, you are right! Thanks for the explanation.
> I will try it with:
> string =~ /^\w+\.\w+\z/

"Are you sure?\nabc.def" =~ /^\w+\.\w+\z/   # :-)

Keep in mind that ^ matches the beginning of any line.

> But is there a ruby operator to look for matches on the entire string?

Do you mean scanning the string repeatedly?  If so, then you can use
String#scan.  If you mean anchoring a regex to the beginning of the
string, then you can use \A and \z (or \Z if you want to discount a
possible ending newline).


David

-- 
                   David A. Black | dblack / wobblini.net
Author of "Ruby for Rails"   [1] | Ruby/Rails training & consultancy [3]
DABlog (DAB's Weblog)        [2] | Co-director, Ruby Central, Inc.   [4]
[1] http://www.manning.com/black | [3] http://www.rubypowerandlight.com
[2] http://dablog.rubypal.com    | [4] http://www.rubycentral.org