A regular expression matches a character that appears at the beginning and the end of a string.
Can be useful in removing an unexpected character (” in this example) from the beginning and the end of a string.
/^\"|\"$/g
Matches:
- “regexpattern“
- “regex”pattern“
- regex”pattern“
- “regex”pattern
See Also:
- Regex To Match A String With No Whitespace At The Beginning And End
- Regex To Match Characters Between Two Strings