Deep Dive into the Inner Workings of 'esmre' Class Library for Python Developers
pip install esmre
python
import esm
python
import esm
engine = esm.Index()
engine.enter("apple")
engine.enter("banana")
engine.enter("cherry")
engine.fix()
matches = engine.query("I like to eat apple and banana.")
for match in matches:
start, end = match
print("Pattern found at position: {}, {}".format(start, end))
python
import esm
engine = esm.Index()
engine.enter("apple")
engine.enter("banana")
engine.enter("cherry")
engine.fix()
new_string = engine.replace("I like to eat apple and banana.", "fruit")
splitted_string = engine.split("I like to eat apple and banana.")