Anita
Anita

Reputation: 77

Match a substring using regex pattern

I'm trying to match a substring using regex.

An example of the substring I've got is: "{{simple-array.text}}{{simple-array.option}}".

Using the following pattern: {(.*?)}, I get the following two matches: {{simple-array.text} and {{simple-array.option}.

I'm not sure how to get the following output using regex: {simple-array.text} and {simple-array.option}.

Upvotes: 0

Views: 174

Answers (1)

HamiltonPharmD
HamiltonPharmD

Reputation: 675

Very close!

Regex Pattern: {({.*?})}

Returns: {simple-array.text} and {simple-array.option} within group 1

Regex101 for validation

Upvotes: 2

Related Questions