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?


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")
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.