2016-03-21 14 views
0
私は、文字列内の {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/)を行うことができましたが、最初の発生をキャプチャします。すべての出来事をキャプチャしてグループに取り込んでください。

+1

使用 'G'フラグ:https://regex101.com/r/cE3aQ1/1 –

+0

それを解決しました! :) – ducin

答えて