To check a any of the word is present in the string without using contains

Mystring1 : WWT( world wide technologies)

mystring2: world wide technologies

Here i cant use mystring2.contains(mystring2)
Please help me out to do any word match

Jhey
You can use the matches activity
Regards

it wont match bcz string 1 and string2 is different

IndexOf is the alternative of Contains, but I’m not sure how to use it. You can try that if you have any idea

it wont be same example as i given it might changes dynamically

indexof always takes staring word right.

Mystring1 : WWT( world wide technologies)

mystring2: world wide technologies

Here i cant use mystring2.contains(mystring2)
Please help me out to do any word match

Please don’t create mutiple topics for the same @brindhaS

1 Like

Hi
Apart from contains method we can use Regex method
Like this
System.Text.RegularExpressions.Regex.IsMatch(strinput.ToString,”(world wide technologies)”)

Cheers @brindhaS

It’s more similar to contains and even that string inside the contains method is a part of the main string then it would give us true or as false
Cheers @brindhaS

my assumption is it returns true only if full string matches

1 Like

Hi @brindhaS

Sorry, but I will have to merge this topic with your other topic because it is the same question…
Forum rules my friend :slight_smile:

@HareeshMR - Thanks for sharing the link to the other post… :slight_smile:

1 Like

Yes that’s correct
And even contains does the same

Cheers @brindhaS

sorry for that

thanks

1 Like

I always want to match from String2 to string1 so it not returns true

Thanks
@Palaniyappan

You mean like you want to search
Mystring2 in Mystring1
Or
Mystring1 in Mystring2

Literally searching Mystring1 in Mystring2 won’t work buddy
But in turn Mystring2 in Mystring1 will work for sure both in contains and Regex method

Cheers @brindhaS

Yes ,it wont work is there is some other way to do

I didn’t get that buddy
Would you like to search mystring2 in mystring2 again
@brindhaS

No Im sorry i did a mistake

mystring2.contains(mystring1)

1 Like

Fine there is a possibility
Like this
System.Text.RegularExpressions.Regex.IsMatch(mystring2.ToString,”(?<=\W\s).*(?=\W)”)

Cheers @brindhaS

1 Like