我正在尝试编写一个正则表达式来捕获字符串中{alphabetical}
的所有出现(例如,让它为无,一个或多个),例如:
This is a {variable}
- > [variable]
This is a {variable} and this is {another} one
- > [variable, another]
This is a {variable} and this is {another} {one}
- > [variable, another, one]
我设法做/(\{[a-z]+})/
(在此测试:https://regex101.com/),但它只捕获了第一次出现。请帮助我捕捉所有出现并将其捕捉到群组中。