in reply to warning using a regexp

/^[\w-'\.\*]*$/
Look at the first few chars within that character class. \w-' the hyphen starts a range (ie: a-z), and whitespace to apostrophe is not a valid range. Perhaps you meant to backslash the hyphen, just as you had to do with the period and the star. Question: do your city names honestly have periods and asterixes (sp?) in them? Perhaps you even want to remove the backslahes from the period and asterix. It would be helpful if you said exactly what you want to check for in the regex.

# The way you might want your regex (will remove error) /^[\w-\'\.\*]*$/

Replies are listed 'Best First'.
Re: warning using a regexp
by Abigail-II (Bishop) on Jan 10, 2003 at 11:52 UTC
    Eh, no, that will still error. Try:
    /^[-\w'.*]*$/

    Abigail

      in fact without warning the first regexp worked... I don't know how but it did....
      I wrote that :
      /^[\w\-'.*]*$/
      Would that be good ?
      It seems to be but I'm cautious now....
Re: Re: warning using a regexp
by Sihal (Pilgrim) on Jan 10, 2003 at 11:22 UTC
    Alright I don't need the asterix but I do need the '.
    I still don't get why I should escape ' since it's not supposed to be a funny char, is it ? And by the way, I didn't fully understood broquaint's explanation (I'm french and I might not understand something properly...)
      All right I looked again at perlre and I'm sorry I forgot - was used to define a range. Now I understand why I have to backslash it. It's a wonder anything worked at all beforehand :-)