-
-
Save jerry-sl/61e23db5e4749962bf7e67cb4a2d3b1c to your computer and use it in GitHub Desktop.
Regular Expression
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>Ruls</h1> | |
• The ? matches zero or one of the preceding group. | |
• The * matches zero or more of the preceding group. | |
• The + matches one or more of the preceding group. | |
• The {n} matches exactly n of the preceding group. | |
• The {n,} matches n or more of the preceding group. | |
• The {,m} matches 0 to m of the preceding group. | |
• The {n,m} matches at least n and at most m of the preceding group. | |
• {n,m}? or *? or +? performs a nongreedy match of the preceding group. | |
• ^spam means the string must begin with spam. | |
• spam$ means the string must end with spam. | |
• The . matches any character, except newline characters. | |
• \d, \w, and \s match a digit, word, or space character, respectively. | |
• \D, \W, and \S match anything except a digit, word, or space character, respectively. | |
• [abc] matches any character between the brackets (such as a, b, or c). | |
• [^abc] matches any character that isn’t between the brackets. | |
• dot-star .* means anything except newline. | |
<h1>Samples</h1> | |
<a[^>]+href=["\'](.*?)["\'] Extract HTML href link. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment