I wanted to post how I went about allowing a special character in an effort to make things maybe a little bit easier for people who do not know how to use regular expressions. There have been references all over the place in separate threads, but this one seems to get referenced a lot. Regular expressions are not my thing, but I did spend a bit of time trying to learn what the default string [^\pL\s\-\!\$\(\)\=\@\d_\']+ is doing. I will try to elaborate for anyone who is curious, but I may be wrong on some of this so will appreciate being corrected if that is the case.
Ultimately I have seen two solutions to allowing special characters into the SeoTitle (Browser Title). One suggestion has been to alter the expression and another has been to just remove it completely. Removing it does work, but at the risk of allowing people to put whatever they want into the title without any type of validation. In either scenario you need to make sure that you do not just alter the SeoTitle, but also the validation section that goes with it. I will link screenshots that show where these are. You need to be sure to make these changes for both FrontendPagesCreate and FrontendPagesEdit.
I wanted to allow a pipe character | into my title's. if you only want to do that then you can just look at the screenshots and see what I did. It seems to work for me. Basically just add the | to the end of the expression within the brackets. i.e. [^\pL\s\-\!\$\(\)\=\@\d_\'|]+
These expressions are what are called character classes and basically they are searching a string for all characters that are not listed within this expression. If any matches are found then it throws the invalid error message.
Character classes are expressed with the brackets [ ]. The + at the end of this expression allows the character class to repeat so that it can match all invalid characters and not just the first one it finds. Setting a caret within this bracket ^ tells it to match against everything that is not within the bracket, which is also called a negated character class. Some of these characters have to be escaped with the backslash.
So here is what is going on. We are searching for everything that does not belong to these matches.
\pL is allowing for a single unicode code point that belongs to a "letter" category.
\s is allowing for all whitespace and non-whitespace characters
\- is allowing a hypen
\! is allowing an exclamation
\$ is allowing a $
\( is allowing the opening parenthesis
\) is allowing the closing parenthesis
\= is allowing the =
\@ is allowing the @
\d is allowing all numeric digets 0-9
_ is allowing the underscore and does not need to be escaped with the backslash
\' is allowing the single tick '
| is allowing the pipe character and does not need to be escaped.