The main use of the form of asking and answer, to express some of the special 0 basis of the regular expression will encounter some problems to be recorded.
We know that regular expressions match strings with a series of rules. In the boundless character of the sea, how to find the "it" you want, obviously there is a certain technical content.
Someone would ask, what's so hard about finding a string? You see, finding "goddess" two words is not minutes?
Yes, finding this is really, not a lot of things are like that. The following expands.
1. Exact match
As said above, want to find what direct input on it, why go through the trouble.
e.g: Goddess
If you're looking for a noun, not a part of a sentence, how do you deal with it?
For example: "Thousands of degrees" and "Baidu" is obviously not a thing, but if you enter "Baidu", two will come out. Orz, too retarded, I clearly as long as Baidu this word, why find "thousands of degrees" in, think is also drunk. So, we need to use some tricks in it, and we'll mention it later. Of course, regular expressions are not all that can be handled, such as this example.
2. Meta-characters
\d------> Digital
Q: I want to find a number, what should I do?
A: Direct input ah, silly bar.
Q: What I'm looking for is not a fixed number, it's any of the 0-9. Is there any way?
A: Do you mean to have something to replace the expression number? So you can do it once and for all? Here is a "\d" you take it.
Q: This will satisfy the requirements? How do I remember this, and how do you know that \d represents numbers, not others? Why the \d, not the \s?
A: You can understand that \d stands for digit. This is obviously easy to remember.
\d------> Digital
"Regular expression" practice log