Skip to content

Latest commit

 

History

History
10 lines (8 loc) · 1.84 KB

regular_expressions.md

File metadata and controls

10 lines (8 loc) · 1.84 KB

Regular expressions

TODO: ADD MORE

  • the re.sub() function of the re module that replaces a regular 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 the re module returns a match object with any matched values from a specified Regular Expression or pre-compiled Regular Expression. The example uses re.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 a Match.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 python re module, or the third-party regex module. Both the original code to be refactored for this exercise and the example solutions use the core re module to access regular expressions functionality. markdown