nltk.re_show()

nltk.re_show(regexp, string, left='{', right='}')[source]

Return a string with markers surrounding the matched substrings. Search str for substrings matching regexp and wrap the matches with braces. This is convenient for learning about regular expressions.

Parameters:
  • regexp (str) – The regular expression.
  • string (str) – The string being matched.
  • left (str) – The left delimiter (printed before the matched substring)
  • right (str) – The right delimiter (printed after the matched substring)
Return type:

str