Check if a string contains only characters from a predefined list

Hi,

I am having list of characters !@#$%^&* ()_

I want to check if my test string contain characters only from above string. Exa,
Test string 1: “*&vgjgu^%$”
Output: False as it contains characters which are not in predefined list.

Test string 2:&%^#%)(”
Output: True as it contains characters only from the predefined list.

Can anyone please help with logic for above without using iteration.

Thanks

new.xaml (7.3 KB)
Refer this workflow

Sorry, getting below error while launching the flow.

Hello

Try this:
yourStr = your text.

Insert the following into an IF Activity:
System.Text.RegularExpressions.Regex.IsMatch(yourStr,“[^\!|\@|\#|\$|\%|\^|\&|\*|\s|\(|\)|_]”) = False

Kapil.xaml (4.6 KB)

image

image

Cheers

Steve

Hey @Kapil


Where character is the list of characters just apply this:

testString1.All(Function(c) character.Contains(c)

)
Put this inside the if condition where testString1 is the test String you mentioned

1 Like

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