-ANSWER to this example is 'var pattern = /(\\n)|(\\r)|(\\t)/g;'
-ANSWER to question is, you can put each pattern in parentheses, separate with a pipe symbol and assign the global identifier at the end of the regex.
TA DA! :)
TRY THIS LINK FOR A HELPFUL REGEX TOOL: https://regex101.com/#javascript
I thought that simple questions like how do you combine regexes would get a simple answer - i don't believe there's a straight answer on the tutorial. But i recommend reading the manual.
I've read a few suggested answers most seem to focus on the pipe OR operator, but i want to combine regexes. Shamefully newbie at regexes. Anyway, I want to remove special characters from tab, space and return. Here's what I have:
var pattern1 = /(\\n)/g;
var pattern2 = /(\\t)/g;
var pattern3 = /(\\r)/g;
$heading = $heading.replace(pattern1, "");
$heading = $heading.replace(pattern2, "");
$heading = $heading.replace(pattern3, "");
This works, however it is repeating and I can't find any info on how to create one regex pattern that will look for all and remove them.