http://qs321.pair.com?node_id=377075


in reply to Re: utf weirdness in regex
in thread utf weirdness in regex

No, it's only any_letter and spaces (I hope). It's supposed to check that a filename only consists of letters (as opposed to control characters, which I'm filtering for).

The trailing period is supposed to be there for the dot in the filename.

Unicode makes things *hard*. :)

Replies are listed 'Best First'.
Re^3: utf weirdness in regex
by hbo (Monk) on Jul 24, 2004 at 05:52 UTC
    But the period matches any character if it isn't escaped.
    /[\w\s\.]+/ # one or more word, space or period characters /[\w\s.]+/ # one or more word. space or *any* characters /.+/ # same as above
    "Even if you are on the right track, you'll get run over if you just sit there." - Will Rogers

      Note that inside a character class, a period is not special: it means just period. So this:

      /[\w\s.]+/
      would match one or more of (word chars, space chars, periods) in any combination.

      In other words, your first two examples are equivalent, not your second two.