Does anyone know how I could best replace all instances of [word] in a text with %s and then build a list or tuple of those [word]s?
Basically, I'm generating PDFs - the text of the PDF I am storing in a TextField in a database - let's say it looks like:
"Hello [patient], you had a study on [date..."
when I generate the PDF on the fly, I want to pass the PDF generator:
"Hello %s, you had a study on %s"%(patient,date)
I don't really feel comfortable with regex. I was reading up on sub and match - but I was wondering if there was a way I could replace the [words] and build the tuple in one line of code.