PyParsing - extract the substring between two markers

PHOTO EMBED

Mon Jun 28 2021 17:26:17 GMT+0000 (Coordinated Universal Time)

Saved by @Quinn #textpreprocessing #nlp #py

import pyparsing as pp

word = pp.Word(pp.alphanums)

s = 'gfgfdAAA1234ZZZuijjk'
rule = pp.nestedExpr('AAA', 'ZZZ')
for match in rule.searchString(s):
    print(match)
content_copyCOPY

extract the substring between two markers

https://stackoverflow.com/questions/4666973/how-to-extract-the-substring-between-two-markers?noredirect=1&lq=1