Shoji
(Shoji Yamada)
February 12, 2023, 10:46am
1
I want to find a certain place in the address provided.
For example: 132, My Street, Kingston, New York, 12401
I want to find “New York” so I do this:
dtPlace.AsEnumerable.Where(function(x) System.Text.RegularExpressions.Regex.IsMatch(CurrentRow("Address").ToString.ToLower, "([^a-zA-Z0-9]|^)+" +x("State").ToString.ToLower + "([^a-zA-Z0-9]|$)+"))
This is working properly and gives me the exact result I want. My only problem is whenever I remove the comma like this (132 My Street Kingston New York 12401), it’s not working anymore. I want this to work, with or without comma.
How do I fix this? Thank you
Yoichi
(Yoichi)
February 12, 2023, 11:35am
2
Hi,
How about the following?
dtPlace.AsEnumerable.Where(function(x) System.Text.RegularExpressions.Regex.IsMatch(CurrentRow("Address").ToString.ToLower, "\b"+x("State").ToString.ToLower + "\b"))
Regards,
2 Likes
Shoji
(Shoji Yamada)
February 12, 2023, 12:06pm
3
This is working, but another issue appeared.
Whenever I have comma: 132, My Street, Kingston, State of New York, 12401
It can’t read the data because in the “State” column I’m reading, it has only “New York” so it doesn’t match with “State of New York”. Thank you.
Yoichi
(Yoichi)
February 12, 2023, 12:50pm
4
Hi,
I think it’s no problem. Th following expression returns True because \b means word boundary.
System.Text.RegularExpressions.Regex.IsMatch("132, My Street, Kingston, State of New York, 12401".ToLower, "\b"+"New York".ToLower + "\b")
Can you check it actual run?
Regards,
Shoji
(Shoji Yamada)
February 12, 2023, 2:25pm
5
This one works, I have mistake so I just fix it. Thank you.
system
(system)
Closed
February 15, 2023, 2:25pm
6
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.