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?

1 Answer 1


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")
  • What is general category? I cannot find regex syntax to specify Nd. [0-9] what I used instead as \c6 is not what it looks.
    – gavenkoa
    Commented Aug 29, 2021 at 20:07
  • 1
    As far as I can tell, there isn't a regex syntax for general-category.
    – npostavs
    Commented Aug 30, 2021 at 13:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.