Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
import re text = "cat bat hat" for m in re.finditer(r"[cbh]at", text): print(f"{m.group()} at {m.start()}-{m.end()}") # cat at 0-3 # bat at 4-7 # hat at 8-11
Result
Open