Sure it's a regular expression's newbie question, I saw it in a program but I can't understand the part of the two backslashes, Does "\\" have a special meaning like \r or \t?
[a-开发者_如何学运维zA-Z]+\\.?
Thank you
The backslash (\) is the escape character in your regular expression pattern which is why \r and \t work, they are regular characters preceded with the escape character to denote a special character you can't just type on your keyboard. To tell the pattern matcher that it should look for an actual backslash, which is what your pattern is doing, you have to escape it thus creating \\.
Yes, \
is the escape character in Regex. \\
means \
and \.
means a single dot while a single dot means any character. If you see that inside a string in a language like C, the double slashes will be picked up by the language compiler and the string will be really \.
which will be parsed by the regex engine as a single dot.
精彩评论