regular expressions in python regular expression are very widely used for finding information in filesfor example finding all lines in log file associated with specific user or specific operationfor validating input such as checking that string is valid email address or postcode/zip code etc support for regular expressions is wide spread within programming languages such as javac#php and particularly perl python is no exception and has the built-in module re (as well as additional third-party modulesthat support regular expressions regular expression patterns you can define regular expression pattern using any ascii character or number thusthe string 'johncan be used to define regex pattern that can be used to match any other string that contains the characters ' '' '' ''nthus each of the following strings will match this pattern'john hunt'john jones'andrew john smith'mary helen john'john john john' am going to visit the john' once saw film by john waynebut the following strings would not match the pattern'jon daviesin this case because the spelling of john is different 'john williamsin this case because the capital does not match the lowercase 'david jamesin this case because the string does not contain the string johnregular expressions (regexsuse special characters to allow more complex patterns to be described for examplewe can use the special characters '[]to define set of characters that can match for exampleif we want to indicate that the may be capital or lower-case letter then we can write '[jj]'--this indicates that either 'jor 'jcan match the first [jj]ohn--this states that the pattern starts with either capital or lowercase followed by 'ohnnow both 'john williamsand 'john williamswill match this regex pattern