Q:

Escaping partial regex pattern

I search to built a pattern composed by some fixed parts and a variable (in reality Business Unit name). In fact, there is high chance that the variable contains some specific regex characters which can be recognize as regex control ones (i.e + or *).
Is there any regex tag that notice that a pattern subpart should be considered only as text, and ignore specific char meaning?
some kind of : 
regex_fixed_part [escape]business + unit[/espace] regex_fixed_part

here, business + unit will be replaced in the parser by business \+ unit
Obviously, I could escape manually all regex char, but I search a more tidy method.
Thanks

A:

Many regex flavors have a utility method that automatically escapes meta characters. Java does this using Pattern.quote(String) and PHP has a similar function: preg_quote(string). Many PCRE implementations also support the \Q and \E escape sequences. \Q will let the regex engine interpret all characters after it as plain literals until the next \E.
Example:
a\Q+*\Eb+

will match the string a+*bbb.

