Get the value inside the standard string format of {{ }}

Hi guys! I need some help.

How can I get the value inside the standard string format of {{ }}?

For example,

  1. “Hello {{NWNP,#,CAL}}”
    Output:
    var1 = NWNP
    var2 = #
    var3 = CAL

  2. “Hello {{TFIP,HM,DIA}} Hi”
    Output:
    var1 = TFIP
    var2 = HM
    var3 = DIA

I just want to get the value inside the standard string format {{ }}

Thank you!

You can split by regex for example

Get value inside the parenthesis:

{{(.+)}}

Or get values:

{{(.+),(.+),(.+)}}

@Shaira_Janine_Torio
an alternate approach combining Regex and Split:

feel free to extend it with StringSplitOptions

2 Likes

Hi,
If the format is same like “Hello {{TFIP,HM,DIA}}Hi”. You can follow below steps
Step-1: Split the string value with space (" “). The result will be in array and capture second value with Position - result(1)
Step-2: No use the replace function. str.replace(”{{","") and str.replace("}}","")
Step-3: Now again use split function with comma (",") and capture the values at position 0,1,2. and store in variables

I wish it can be help. Mark as solution if it works

Thank you!

Its working! Thank you!

Thank you!!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.