Skip to content

Instantly share code, notes, and snippets.

@dheerapat
Last active October 5, 2024 17:49
Show Gist options
  • Select an option

  • Save dheerapat/46c939898c3d299e1a9d74f5f8daa198 to your computer and use it in GitHub Desktop.

Select an option

Save dheerapat/46c939898c3d299e1a9d74f5f8daa198 to your computer and use it in GitHub Desktop.
python regex example
import re
txt = """<|python_tag|><function=spotify_song_artist>{"n": "[\"BIRDS OF A FEATHER\", \"Espresso\", \"Please Please Please\", \"Not Like Us\", \"Gata Only\"]"}</function>"""
x = re.search("<function=(\w+)>(.*?)</function>", txt)
if x:
print("YES! We have a match!")
print(x.group())
else:
print("No match")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment