click below
click below
Normal Size Small Size show me how
PythonRegex
Python Reguler Expression for parsing Text
Term | Definition |
---|---|
[] | Specify Set of characters to match,Whatever you will write inside it will match |
. | It matches any single character except new line.The dot will match anything |
\ | Forward slash treat meta characters as ordinary characters |
| | Either / OR |
^ | Matching starting character of string |
$ | Matching ending chracter of string |
{} | When used after a something it finds exact number occurences |
() | Capture or group. It returns a tuple . You can group multiple search patterns |
\A | Returns a match if the specified characters are at the beginning of the string. E.g "\AThe" |
\b | Check if a pattern is present at the beginning or end of word e.g ain\b and it will match rain |
\B | Check if a pattern shouldnt be at start or end \B*** for start and ***\B for end |
\d | Returns a match where the string contains digits (numbers from 0-9) |
\D | Returns a match where the string DOES NOT contain digits |
\s | Returns a match where the string contains a white space character |
\S | Returns a match where the string DOES NOT contain a white space characte |
\w | Returns a match where the string DOES NOT contain any word characters |
\Z | Returns a match if the specified characters are at the end of the string , works like $ sign |
* | It checks for pattern followed by 0 or more chracters and record every occurence |
+ | It checks for pattern followed by 1 or more chracters and record every occurence ,ai |