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. Advertisements

  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. Advertisements

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,694
  2. Andrew Banks
    Replies:
    2
    Views:
    21,285
    Andrew Banks
    Jan 5, 2004
  3. Jay Douglas
    Replies:
    3
    Views:
    3,699
    Jay Douglas
    Aug 27, 2004
  4. Sreedhar Vankayala
    Replies:
    2
    Views:
    863
    Sreedhar Vankayala
    Dec 4, 2004
  5. Beffmans

    Regular expression with numbers

    Beffmans, Jul 7, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    497
    Hans Kesting
    Jul 7, 2005
  6. rahul
    Replies:
    12
    Views:
    382
    Gunnar Hjalmarsson
    May 12, 2005
  7. Dylan Nicholson
    Replies:
    6
    Views:
    508
    A. Sinan Unur
    Oct 19, 2007
  8. Raj
    Replies:
    5
    Views:
    197
    RedGrittyBrick
    Dec 13, 2007
Loading...