Hello I’m beginner in using regex, I’m stuck with this problem.
Supposedly, I’m extracting 3 different data (“Province”, “Municipality” and “Barangay”) from different address. I got this problem wherein it does not match my data.
sample address: BLOCK 50 LOT 2 11TH COR 20TH ST BRGY 183 VILLAMOR PASAY METRO MANILA
I want the output to look like this:
Province = Metro Manila
Municipality = Pasay
Barangay = Barangay 183
My problem is I can’t output Barangay 183
My regex look like this:
dtRef.AsEnumerable().Where(Function(x) System.Text.RegularExpressions.Regex.IsMatch(CurrentRowData("Address").ToString().ToLower().Replace(",", ""), "\b(?i)(Brgy|BRGY|Barangay|BARANGAY)\W*" + x("Barangay").ToString.ToLower + "\b")).Count()
Another example is this address: 311 PUROK 1 BARANGAY MATAAS NA KAHOY GENERAL M. NATIVIDAD NUEVA ECIJA
Expected Output:
Province = Nueva Ecija
Municipality = General M. Natividad
Barangay = Mataas Na Kahoy
But I’m getting this output:
Province = Nueva Ecija
Municipality = General M. Natividad
Barangay = Mataas