Как извлечь подстроки подстановки из строки в Python? - PullRequest
0 голосов
/ 13 июня 2019

У меня есть эта строка "this ${is} a sample ${text}" Я хочу список всех подстрок, которые обернуты $ {}

Я попробовал это, и это сработало

re.findall("{(.*?)}", "this ${is} a sample ${text}")
['is', 'text']

However, I would like to narrow down the search by using the $ symbol too. 
The following command return []
re.findall("${(.*?)}", "this ${is} a sample ${text}")


re.findall("${(.*?)}", "this ${is} a sample ${text}")

The expected output should be ['is', 'text']
...