6

The regex info material suggests that \\c6 should match digit characters.

In UTF-8 encoded buffers it doesn't; some of the other category letters work as expected (l, |, a).

Shouldn't \\c6* match 456 in test456test? What do I overlook, misunderstand?

Tom Regner
  • 904
  • 1
  • 9
  • 13

1 Answers1

5

It seems the main problem is that the ascii characters 0..9 aren't in the digit category, C-u C-x = shows category: .:Base, a:ASCII, l:Latin, r:Roman (it also has general-category: Nd (Number, Decimal Digit), but apparently that's not what \cC looks for).


Shouldn't \\c6* match 456 in test456test?

Also note that \\c6* matches the empty string.

(let ((str "test456test"))
  (list (progn (string-match "[0-9]*" str) (match-string 0 str))
        (progn (string-match "[0-9]+" str) (match-string 0 str)))) ;=> ("" "456")
npostavs
  • 9,203
  • 1
  • 24
  • 53