This link has been bookmarked by 51 people . It was first bookmarked on 03 Mar 2007, by Kazuhiko Uebayashi.
-
10 Mar 16
-
25 Dec 15
-
10 May 14
-
22 May 12
-
11 Mar 12
-
To get all matches from a string, call re.findall(regex, subject). This will return an array of all non-overlapping regex matches in the string. "Non-overlapping" means that the string is searched through from left to right, and the next match attempt starts beyond the previous match. If the regex contains one or more capturing groups, re.findall() returns an array of tuples, with each tuple containing text matched by all the capturing groups. The overall regex match is not included in the tuple, unless you place the entire regex inside a capturing group.
-
You can use and \t in raw strings. Though raw strings do not support these escapes, the regular expression engine does. The end result is the same.
-
To avoid this confusion, just use Unicode raw strings like ur"\u00E0\d". Then backslashes don't need to be escaped. Python does interpret Unicode escapes in raw strings.
-
-
27 Sep 11
-
26 Aug 11
-
14 Jul 10
-
28 May 10
-
12 Dec 09
-
06 Jun 09
-
20 Mar 09
-
04 Dec 08
-
11 Nov 08
-
Alternatively, you can specify re.U or re.UNICODE to treat all letters from all scripts as word characters.
-
The only limitation of using raw strings is that the delimiter you're using for the string must not appear in the regular expression, as raw strings do not offer a means to escape it.
-
-
26 Aug 08
-
22 Aug 08
-
10 Feb 08
-
14 Oct 07
-
16 Sep 07
-
30 May 07
Shane GraberPython's built-in "re" module provides excellent support for regular expressions, with a modern and complete regex flavor,.
-
05 May 07
vikramsjnPython's built-in "re" module provides excellent support for regular expressions, with a modern and complete regex flavor,. The only feature currently missing from Python's regex syntax are atomic grouping and possessive quantifiers.
python regex reference tutorial intro deliciousExport20110319
-
03 Mar 07
-
Python is a high level open source scripting language. Python's built-in "re" module provides excellent support for regular expressions, with a modern and complete regex flavor,. The only feature currently missing from Python's regex syntax are atomic grouping and possessive quantifiers.
-
-
02 Jan 07
-
20 Sep 06
-
13 Sep 06
-
29 Aug 06
-
14 Jul 06
-
30 Oct 05
-
05 Jan 89
Would you like to comment?
Join Diigo for a free account, or sign in if you are already a member.