Java Regex to get Data between curly brackets

后端 未结 2 367
北恋
北恋 2021-01-15 04:52

I am looking for a regular expression to match the text between curly brackets.

{one}{two}{three}

I want each of these as separate groups,

2条回答
  •  失恋的感觉
    2021-01-15 05:10

    If you want 3 groups, your pattern needs 3 groups.

    "\\{([^}]*)\\}\\{([^}]*)\\}\\{([^}]*)\\}"
                  ^^^^^^^^^^^^^
    

    (The middle part is the same as the left and right).

提交回复
热议问题