TODO: ADD MORE
- the
re.sub()
function of there
module that replaces aregular expression
match with a new value. The example solutions use this function in various places to substitute markdown syntax for HTML syntax in the passed in markdown text. markdown - Both the original code to be refactored for this exercise and the example solution import and use the
re
module for Regular Expressions in python. markdown - the
re.match()
function from there
module returns amatch
object with any matched values from a specified Regular Expression or pre-compiled Regular Expression. The example usesre.match()
in multiple places to search for text patterns that need re-formatting or substituting. markdown - Various functions in the re module return a
re.Match
instance which in turn has aMatch.group
method.Match.group
exists even if there are no groups specified in the pattern. See the Match.group docs for more detail. markdown - regular expressions is a language of sorts that can detect substrings and extract groups from a string, as well as replace them with something else phone-number
- A Domain Specific Language (DSL) for text processing. Like many other programming languages in use, python supports a quasi-dialect of PCRE (Perl compatible regular expressions).
Regular expressions
can be used via the core pythonre
module, or the third-partyregex
module. Both the original code to be refactored for this exercise and the example solutions use the corere
module to accessregular expressions
functionality. markdown