Why "$4.99?" needs three backslashes before a regex can find it
A regular expression is a small language, and most of its words are single characters. A dot means any character. A question mark makes the thing before it optional. A dollar sign means the end of the line, and brackets of every kind group or list things. That is convenient when you are writing a pattern, and a trap when you only want to find a piece of text that happens to contain those characters.
Take a product line: price (USD): $4.99? Used as a pattern without escaping, it does not find itself. The brackets become a group, the $ asks for the end of the line in the middle of the text, the dot matches any character, and the ? makes the last 9 optional. Escaped, it becomes price \(USD\): \$4\.99\? with a backslash before each bracket, the dollar sign, the dot and the question mark. Every other character, letters, digits, the colon and the spaces, is already literal and is left alone. Paste the line into the box above and that is what comes back.
Escaping more than needed sounds safe but is not. Many engines accept a backslash before any punctuation, so \- or \: does no harm there. JavaScript is stricter: in a pattern with the u or v flag, an escape before a character that has no special meaning is a syntax error, so \- outside brackets breaks the whole pattern. The 14 syntax characters and the slash are the set that every common engine accepts escaped, which is why the tool escapes exactly those. Python's re.escape and Perl's quotemeta escape more, which is fine in those languages but not always when the pattern is copied somewhere else.
Match any line covers a common next step. Paste a list, such as a.b on one line and c+d on the next, and each line is escaped on its own and joined with a vertical bar: a\.b|c\+d. That pattern matches either line. If it is going inside a larger pattern, wrap it in a group, (?:a\.b|c\+d), so the bar does not split the rest of the pattern in two.
Two limits are worth knowing. First, this output is the pattern itself, not a string in your language. If you put it inside quotes in Java, C# or JavaScript, each backslash may need to be doubled, because the string reads backslashes before the regex engine does. Second, the escaping is for the main part of a pattern. Inside square brackets the rules are different: there ^ at the start, - between characters and ] are special, and a dot is just a dot. If you are building a character class by hand, escape those three yourself.