How to pattern match the string

in this I want to pattern match the string lunch.
if they type lunch money. I want to match the string lunch in that

how to use the regular expression to match the string.

You can use the CSharp Contains method returns true if and only if this string contains the specified sequence of char values.

If the str Contains in the String then it returns true

If the str does not Contains in the String it returns False

For ex: “This is a Test”.Contains(“is”) return True

“This is a Test”.Contains(“yes”) return False

Regards,
Prashant

1 Like

can we use the regular expression for this

yes try below below one

System.Text.RegularExpressions.Regex.IsMatch(“My name is Bhanu”,“Bhanu”)

it returns boolean value as output

2 Likes

ok ill try this

You can try also isMatch activity directly

1 Like

hi iam try to match the Lunch in switch its not comming .

Hi @akshaygm12,

Instead of IsMatch, you can also make use of string.contains.

and also how can i convert a string to upper case .

string.toupper

ya got it .any one help me with the string matching in case

That means String matching should be case sensitive?

no match the string in the switch if it match then do some operation

Maybe this post will be useful it the string value is known.

If the string values changes and only part of the string value matches the case value,

Instead of true or false, i want the string matched to be displayed.How will i get it.

@KeertiJ Try below Regex method, match return single value

System.Text.RegularExpressions.Regex.Match(“My name is Bhanu”,“Bhanu”).ToString

You can also use matches and returns multiple results if available.

System.Text.RegularExpressions.Regex.Matches(“My name is Bhanu”,“Bhanu”)

1 Like

eg : conside i’m passing string month eg: January
it should search with all months(January-december) and if January matching with list of month it should display matched …
can any one please help me
Thnaks in advance

Kind Regards
Vamshi

Hi @vamshiRaghava_Midjil,

Welcome to our community!

MatchWithListOfMonth.xaml (6.2 KB)

Thanks!

1 Like

Thanks its working fine :grinning::smiley: