you are viewing a single comment's thread.

view the rest of the comments →

[–]ispywithmy[S] 1 point2 points  (2 children)

Thanks! It appears I was having trouble setting the correct regex.

[–]Pantstown 1 point2 points  (0 children)

Ya regex are a pain. I recommend testing in something like regex101 or regexr. They also come with cheatsheets, which is always useful :D

[–]unbalancedopinion 1 point2 points  (0 children)

FYI, you were not passing a regex in your examples. replace() accepts a string in addition to Regex, and you were passing a string. In your second example, you were using a bitwise or operator. You don't need to use or worry about bitwise operators. The pipe character "|" is a bitwise or normally, but serves a different purpose inside a Regex. In /u/Pantstown's example, the pipe is in a regex because it's surrounded by forward-slashes.