From: "David A. Black" Date: 2008-09-02T03:01:48+09:00 Subject: Re: Looking for a regular pattern On Mon, 1 Sep 2008, David A. Black wrote: > Hi -- > > On Mon, 1 Sep 2008, Peter Hickman wrote: > >> Zhao Yi wrote: >>> Sebastian Hungerecker wrote: >>> >>>> Zhao Yi wrote: >>>> >>>>> I think this is better [.\s] >>>>> >>>> No, it's not. >>>> >>> >>> Why? It should match any character. >>> >> From the docs, http://www.ruby-doc.org/docs/UsersGuide/rg/regexp.html >> >> |\s| space character; same as |[ \t\n\r\f] >> >> That is not any character it is only whitespace. > > Yes, but [.\s] is a character class, consisting of any character other > than \n, plus any space including \n. So it will match any character. In case you didn't see James Gray's correction, let me inform you what I've written here is rubbish. The dot in a character class is just a dot, not a wildcard. David -- Rails training from David A. Black and Ruby Power and Light: Intro to Ruby on Rails January 12-15 Fort Lauderdale, FL Advancing with Rails January 19-22 Fort Lauderdale, FL * * Co-taught with Patrick Ewing! See http://www.rubypal.com for details and updates!