bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#10649: 23.4; Regexp char classes not working


From: Glenn Morris
Subject: bug#10649: 23.4; Regexp char classes not working
Date: Mon, 30 Jan 2012 03:06:43 -0500
User-agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)

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:

34.3.1.2 Character Classes

Here is a table of the classes you can use in a character alternative,
                                            ^^^^^^^^^^^^^^^^^^^^^^^^^

34.3.1.1 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]