First we read help("regex")
:
[:lower:]
Lower-case letters in the current locale.
Similar for [:upper:]
and [:alpha:]
is just the union of them.
Then we can check the current locale's character set:
Sys.getlocale("LC_CTYPE")
#[1] "German_Germany.1252"
l10n_info()
#$MBCS
#[1] FALSE
#
#$`UTF-8`
#[1] FALSE
#
#$`Latin-1`
#[1] TRUE
#
#$codepage
#[1] 1252
Then we can go to the internet and e.g. to Wikipedia.
Then we can try this:
gsub("[^[:alpha:]]", "", rawToChar(as.raw(1:(16^2-1))))
#[1] "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ"
gsub("[^[:cntrl:]]", "", rawToChar(as.raw(1:(16^2-1))))
#[1] "\001\002\003\004\005\006\a\b\t\n\v\f\r\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\177€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ"