Regular Expression for words (with umlauts, without numbers)

Discussion in 'Python' started by Jens Lechtenboerger, May 13, 2011.

  1. Dear experts,

    I'm looking for a regular expression to recognize natural language
    words with umlauts but without numbers. While \w with re.U does
    recognize words with umlauts, it also matches numbers, which I do
    not want.

    Is there a better way than an exhaustive enumeration such as
    [-a-zàáâãäåæ...]?

    I guess there should be a better way as \w appears to know about
    alphabetical characters...

    Thanks in advance
    Jens
    Jens Lechtenboerger, May 13, 2011
    #1
    1. Advertising

  2. On 2011-05-13, Peter Otten wrote:

    > Jens Lechtenboerger wrote:
    >
    >> I'm looking for a regular expression to recognize natural language
    >> words with umlauts but without numbers. While \w with re.U does
    >> recognize words with umlauts, it also matches numbers, which I do
    >> not want.
    >>
    >> Is there a better way than an exhaustive enumeration such as
    >> [-a-zàáâãäåæ...]?
    >>
    >> I guess there should be a better way as \w appears to know about
    >> alphabetical characters...

    >
    > How about [^\W\d] ?


    Brilliant.

    Thanks
    Jens
    Jens Lechtenboerger, May 13, 2011
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. VSK
    Replies:
    2
    Views:
    2,283
  2. Peter Strøiman
    Replies:
    1
    Views:
    2,082
    Peter Strøiman
    Aug 23, 2005
  3. rahul
    Replies:
    12
    Views:
    225
    Gunnar Hjalmarsson
    May 12, 2005
  4. Dylan Nicholson
    Replies:
    6
    Views:
    372
    A. Sinan Unur
    Oct 19, 2007
  5. Raj
    Replies:
    5
    Views:
    100
    RedGrittyBrick
    Dec 13, 2007
Loading...

Share This Page