Placeholder in variables wanted! e.g. **_text

Hello Community,

I have the following problem:
For an email robot I want to use the subject as a variable. This should be used in a flowchart as a decision base. However, a part of the variable is unknown and is determined by the user.
How can I put a placeholder in such a variable?

Excel with the count-if function serves as an example:
=Count-If(A2:A5; “") with the placeholder "”.

Here’s what I had in mind (which didn’t work):
Variable = * & “Text”

Thanks for your help!
Kind regards

Hi @nowak.moritz

Is this what you are looking for

Say you want to include a value in sentence ‘I am good’ after am then give the string loke this “I am good”(stored in str variable) and in your code you can use replace
Str.Replace(“”,”very”)

Output - I am very good

In here “very” can be another variable which user gives as input

Cheers

Hi,

How about String.Format as the following?

image

String.Format(yourString,strName)

Regards,


Thanks for the answers! Unfortunately, I have expressed myself somewhat incomprehensibly.

My goal is to perform a decision in the FlowChart by a string (email subject). Here I want to trigger different applications by different subjects (e.g. animals, countries, colors). However, each category has subcategories e.g. DE_country, ES_country, IT_country. So that the program recognizes the supercategory country with special email subjects, I would like to make the checking variable.

The program should ignore the first letters and only look at the rest **_country. A split is not possible, because some words have 3 code digits in front of them e.g. RED_Color.

Hi,

Do you mean you need to extract just after the first underscore? If so, the following will work.

image

System.Text.RegularExpressions.Regex.Match(yourString,"(?<=^.*?_).*").Value

Regards,

This should be =COUNTIF(A2:A5;“*”&“country”), The text formatting shot it up

HI @nowak.moritz

You can use like this

Str.Substring(str.LastIndexOf(“_”)+1)

cheers

Thank you! Do I see correctly that “?<=^.*?” is the placeholder up to the “_”?

Hi,

The above is lookbehind of regex. It will match from beginning of the string to the first _ character but not return any characters. So, it will behave like placeholder you said.

Regards,

Use the Contains operator.

(post deleted by author)

How does it look if I need the first arbitrary characters up to the “_”? e.g. CAT_XX

Hi,

If you need to extract characters before the first _, the following will work.

m = System.Text.RegularExpressions.Regex.Match(yourString,"(^.*?)_(.*)")

Then

m.Groups(1).Value
m.Groups(2).Value

Note: m is Match type.

Sample20221128-3aL.zip (2.3 KB)

Regards,

1 Like

Thanks for the quick help! You have saved me a lot of time :slight_smile: @Yoichi

1 Like

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