Search for part of word then extract whole word in string

i have a variable string
str = “Hello this is string TMS.001.XXXX”

first i check using '.contain(“TMS.001”) to see if it exists in string
but now i want to extract the whole word i.e “TMS.001.XXXX”

How can i do this?


Can you try the following expression?



it does work. but say if my string changes to
str = ““Hello this is string TMS.001.XXXX extra word”

the output is “TMS.001.XXXX extra word”

so anything after TMS.001.XXXX is also been included

how can i do it just so i extract that word

thank you @Yoichi


How about the following?



perfect mate. thank you

1 Like

just a quick one, is there a way to count how many different ways this code “TMS.001” occurs?
for example:
str = "TMS.001.XXXL and “TMS.001.XXLL”
would occur twice


We can get it using the following expression.


If we want to get each matched string, the following will work.

mc = System.Text.RegularExpressions.Regex.Matches(yourString,"TMS\.001\.\S*")

Then mc.Count returns its count.
And If use ForEach activity, we can get each item of MatchCollection. (Please set TypeArgument as System.Text.RegularExpressions.Match type)

Note : mc is MatchCollection type.


That works. thank you

1 Like

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