Example one:
Regular: (? <= (Href|src|filepath) =) \s+? (\.jpg|\. JPG)
Parsing: The expression is divided into three segments
First paragraph:
(? <= (Href|src|filepath) =) Gets the starting position meaning that the match begins after the three characters that begin with href=, src=, and filepath=.
Use the regular (? <=pattern), if not < then start matching from that character.
Second paragraph:
\s+? The middle of the configuration character. Attention? Represents the minimum match, that is, the first one to match.
Third paragraph:
(\.jpg|\. JPG) The end of the character meaning is the position at the end of the. jpg or. jpg.
This expression can be used to obtain an HREF or src or an address behind a filepath.
For example,
Match result is http://avatar.csdn.net/8/3/2/1_xanxus46.jpg
Example Two
Regular: (.) \\1 (.) \\2
The expression to use
\num matches num, where num is a positive integer. A reference to the obtained match. For example, "(.) \1 "matches two consecutive identical characters. Parse: Match two (can be same) duplicate character, for example: HTTTPP match result TTPP (not same) HTTTTPP match result is tttt (same)
Regular expression Learning examples