parsing xml files regular expressions regexes are widely and successfully used to create parsersthey do have limitation in that areathey are only able to deal with recursively structured text if the maximum level of recursion is known alsolarge and complex regexes can be difficult to read and maintain so apart from simple casesfor parsing the best approach is to use tool designed for the purpose--for exampleuse dedicated xml parser for xml if such parser isn' availablethen an alternative to using regexes is to use generic parsing toolan approach that is covered in at its simplest regular expression is an expression ( literal character)optionally followed by quantifier more complex regexes consist of any number of quantified expressions and may include assertions and may be influenced by flags this first section introduces and explains all the key regular expression concepts and shows pure regular expression syntax--it makes minimal reference to python itself then the second section shows how to use regular expressions in the context of python programmingdrawing on all the material covered in the earlier sections readers familiar with regular expressions who just want to learn how they work in python could skip to the second section the covers the complete regex language offered by the re moduleincluding all the assertions and flags we indicate regular expressions in the text using boldshow where they match using underliningand show captures using shading python' regular expression language ||in this section we look at the regular expression language in four subsections the first subsection shows how to match individual characters or groups of charactersfor examplematch aor match bor match either or the second subsection shows how to quantify matchesfor examplematch onceor match at least onceor match as many times as possible the third subsection shows how to group subexpressions and how to capture matching textand the final subsection shows how to use the language' assertions and flags to affect how regular expressions work characters and character classes |the simplest expressions are just literal characterssuch as or and if no quantifier is explicitly given it is taken to be "match one occurrencefor examplethe regex tune consists of four expressionseach implicitly quantified to match onceso it matches one followed by one followed by one followed by one eand hence matches the strings tune and attuned