Regular Expression

4.8K posts

Regular Expression banner
Regular Expression

Regular Expression

@RegexTip

Learn to use regular expressions by following RegexTip. From @JohnDCook.

Katılım Kasım 2009
19 Takip Edilen74.6K Takipçiler
Regular Expression
Regular Expression@RegexTip·
What we call 'regular expressions' today includes more general patterns than the original definition from the 1950's.
English
0
0
3
829
Regular Expression
Regular Expression@RegexTip·
The escape character \ makes special characters literal. For example, \. matches a period.
English
0
1
3
733
Regular Expression
Regular Expression@RegexTip·
.* will match as much as it can, but then backtrack if the next atom can also be matched. Backtracking on some engines is slow.
English
0
0
3
806
Regular Expression
Regular Expression@RegexTip·
(Fine print: whether . matches a newline character depends on the implementation and configuration options.)
English
0
0
2
1.2K
Regular Expression
Regular Expression@RegexTip·
A dot matches any single character. For example, /r.de/ matches 'ride', 'rode' etc.
English
0
0
9
1.3K
Regular Expression
Regular Expression@RegexTip·
+ means one or more occurrences. For example, /ab+c/ matches 'abc' or 'abbc' or 'abbbbbbc'.
English
0
0
6
1.1K
Regular Expression
Regular Expression@RegexTip·
? means a character or expression is optional, i.e. zero or one occurrences. Example: /ab?c/ matches 'ac' and 'abc' but not 'abbc'.
English
0
0
7
1.2K
Regular Expression
Regular Expression@RegexTip·
* means zero or more occurrences. Ex: /ab*c/ matches 'ac', 'abc', 'abbc', etc.
English
0
0
7
943
Regular Expression
Regular Expression@RegexTip·
Languages have minor variations in their regex support. @RegexTip mostly sticks to the common features of Perl, C#, Python, JavaScript, ...
English
0
1
5
1.2K
Regular Expression
Regular Expression@RegexTip·
Properties such as \p{Alphabetic} can be easier to read than [A-Za-z]. Works better with internationalization as well.
English
0
0
6
1.3K
Regular Expression
Regular Expression@RegexTip·
Adding a + after a quantifier tells it to not give anything back when the regex engine backtracks.
English
0
0
6
1.2K