Hi,
I want to check if starting words matching with keywords or not if matched then return keyword value.
Note: keywords are not fixed and more than 60 keywords are there and more will be added in future.
Sample Keywords
Paytm
Phonepe
Google Pay
Amazon pay later
Example 1.
String input:
“Paytm transaction of 6788 rs received”
Output:
Paytm
Example 2
String input:
“Received transaction from other party Phonepe through external”
Output:
No output
Note: we want only starting word
Example 3
String input:
“Received Google Pay transaction from XYZ company”
Output:
No output
Note: we need to check starting words here Received word is starting word not Google.
Example 4
String input:
“Amazon pay later transaction received from xyz user”
Output:
Amazon pay later
Sry…
As mentioned we have more than 60 keywords and more can be added in future also keywords can be two words like Amazon pay later or Sahara Internet.
result = System.Text.RegularExpressions.Regex.Match(yourString,"^("+String.Join("|",arrKeywords.Select(Function(s) System.Text.RegularExpressions.Regex.Escape(s)))+")").Value
For some keywords other word is occurring at the start of the string and those words are not fixed so want to build logic with the help of staring 4-5 words check.