简体   繁体   中英

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} .

Very close!

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

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

Regex101 for validation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM