13.4 Predefined variables to use in regular expressions:
[:lower:] | Lower-case letters |
[:upper:] | Upper-case letters |
[:alpha:] | Alphabetic characters: [:lower:] and [:upper:] |
[:digit:] | Digits: 0 1 2 3 4 5 6 7 8 9 |
[:alnum:] | Alphanumeric characters: [:alpha:] and [:digit:] |
[:print:] | Printable characters: [:alnum:], [:punct:] and space. |
[:punct:] | Punctuation characters: ! " # $ % & ’ ( ) * + , - . / : ; < = > ? @ [ ] ^ _ ` { | } ~ |
[:blank:] | Blank characters: space and tab |
[:upper:] | Upper-case letters |
[:alpha:] | Alphabetic characters: [:lower:] and [:upper:] |
[:digit:] | Digits: 0 1 2 3 4 5 6 7 8 9 |
[:alnum:] | Alphanumeric characters: [:alpha:] and [:digit:] |
[:print:] | Printable characters: [:alnum:], [:punct:] and space. |
[:punct:] | Punctuation characters: ! " # $ % & ’ ( ) * + , - . / : ; < = > ? @ [ ] ^ _ ` { | } ~ |
[:blank:] | Blank characters: space and tab |
- Take the previous character vector containing email addresses:
- Remove the @ and the email provider from each address
## [1] "marie.curie" "albert.einstein01" "charles.darwin1809"
## [4] "rosalind.franklin"
* Same thing but remove additionally any number(s) BEFORE the @ (if any):
## [1] "marie.curie" "albert.einstein" "charles.darwin"
## [4] "rosalind.franklin"
* Same but simplified:
## [1] "marie.curie" "albert.einstein" "charles.darwin"
## [4] "rosalind.franklin"