Exercise
Please use regular expression to answer the following:
- How can you get rid of ALL characters after the
"@"symbol inc("wtl2109@columbia.edu is my email", "n0t_rea1_account@yahoo.com")? - How can you erase the zip code from the following address
c("1255 Amsterdam Ave New York, NY 10027", "612 W 115th St #715 New York, NY 10025")with regular expression? - How can you replace all words that start with capital letter with an empty string
c("Harry Ng works at Walgreens", "Larry Saltz is his name")? - Repeat all the examples in the teaching section but replace everything with
gsub()instead ofsub()and guess the outcome before running the code.