Hello I’m using word boundary “\b” to search for specific word. My problem occurs when I’m extracting something with same name in the same column.
For example, I have this person address: Abad Avenue Tondo Manila
The output I’m getting is this:
I’m getting “Manila” in the last column because there’s also “Manilla” in the “Barangay” column but it belongs to another place.
Here, I provided the xaml file
Main.xaml (33.6 KB)
How do I fix this?
How about the following single regex instead of 3 regex.ismatch?
dtRef.AsEnumerable.Where(Function(x) System.Text.RegularExpressions.Regex.IsMatch(CurrentRowData("Address").ToString.ToLower, "\b"+x("Province").ToString.ToLower+"\b.*\b"+x("Municipality").ToString.ToLower+"\b.*\b"+x("Barangay").ToString.ToLower+"\b")).Count > 0
It might be necessary to change order of Province, Municipality and Barangay.
It’s the same result, do I need to put that in all my if condition?
Can you share input data and expected output as file? It’s no problem if dummy data.
Hello, sorry for the late reply
Here’s the file containing the output I got and the expected output:
address.xlsx (21.7 KB)
Here’s also the list of the areas:
area.xlsx (842.9 KB)
Hello, I just want to let you know that I already fixed it using your solution. My question is, what does this “\b.*\b” do? This help me with the problem. Thank you!
\b means word boundary. For example, Can you check the following sample? The former matches
This. However the latter doesn’t match it because \b doesn’t match word boundary.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.