Print word that got matched

Hi I am able to check where input text contain word from dt using the below linq

in_dtCustomerService.AsEnumerable().Any(Function(row) Str_message.ToLower.Contains(row.Field(Of String)(0).ToLower))

how to i print the word that got matched from dt.

where you want to print output either text file? or in logs?

image

Use for each row in data table;if you want to print it in a log message add the log messge inside the body and write currentItem in message field

Hi @tharani.natarajan

For Each row In in_dtCustomerService.AsEnumerable()
    If Str_message.ToLower.Contains(row.Field(Of String)(0).ToLower) Then
        LogMessage-"Matched Word: " & row.Field(Of String)(0)
    End If

I want to print the word from the string that contained the word from string.

For eg
my dt is
order
missing

Input strinng is =" i ordered yesterday "

i need to print order (as ordered contains order)

matchedWord = in_dtCustomerService.AsEnumerable() _
.Where(Function(row) Str_message.ToLower.Contains(row.Field(Of String)(0).ToLower)) _
.Select(Function(row) row.Field(Of String)(0)) _ .FirstOrDefault()

If you’re using a Message Box activity:

  • Drag and drop a Message Box activity into your workflow.
  • In the “Text” property of the Message Box activity, use the matchedWord variable to display the matched word.

Hi @tharani.natarajan ,

We see that there was a similar Query from your end a few days back and you had it resolved, could you let us know how the current topic is different ?

We are trying to avoid duplicate topics also :slight_smile:

In the previous post the regex solution worked but the printing the word that got matched didn’t work .So I created a new one .My bad i marked the other answer by same person as solution .I corrected it now.

Sorry for the confusion . :slight_smile:

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