[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#10649: 23.4; Regexp char classes not working

From: Raffaele Ricciardi
Subject: bug#10649: 23.4; Regexp char classes not working
Date: Tue, 31 Jan 2012 20:47:52 +0000
User-agent: Mozilla/5.0 (X11; Linux i686; rv:9.0) Gecko/20111222 Thunderbird/9.0.1

Ouch!  I did RTFM, but the brackets confused me.  Thank you.

On 01/30/2012 08:06 AM, Glenn Morris wrote:
Raffaele Ricciardi wrote:

- start emacs -Q
- evaluate this forms:
(string-match "[:xdigit:]" "0")
(string-match "[:xdigit:]" "a")
(string-match "[:alnum:]" "5")
They should return non-nil, but they return nil instead.

 From the elisp manual: Character Classes

Here is a table of the classes you can use in a character alternative,
                                             ^^^^^^^^^^^^^^^^^^^^^^^^^ Special Characters in Regular Expressions
`[ ... ]'
      is a "character alternative", which begins with `[' and is
      terminated by `]'

Therefore you must write eg

   (string-match "[[:xdigit:]]" "0")

reply via email to

[Prev in Thread] Current Thread [Next in Thread]