Regular expression to remove anything but alphabets and '[single quote]

How can I change this regular expression to remove everything from a string except alphabets and a ‘(single quote)?

pattern = /\b(ma?c)?([a-z]+)/ig;
  1. this pattern removes unwanted spaces and capitalizes the first letter and turns the rest into lower case
  2. By alphabets I mean English letters a-z.

2 thoughts on “Regular expression to remove anything but alphabets and '[single quote]”

Leave a Comment