How to use regex capturing-group in custom US Address information in Office365

56 Views Asked by At

I'm trying to create a custom U.S Address classification label in Azure Information Protection to match possible U.S Addresses

Regex (it works Java8 - e.g. https://regex101.com/):

^(\d+) ?(\w)? (.*?) ?((?<= )avenue|ave|court|ct|street|st|drive|dr|lane|ln|road|rd|blvd|plaza|parkway|pkwy)? ?((?<= )\d*)?$

But when I try to set this code in Azure Information Protection I receive the error message below:

You cannot configure a pattern with groups or multiple match conditions like (.*, .+, .{0,n} or .{1,n}). Remove the group or the multiple match condition from the pattern to continue.

Is there a way to circumvent this situation? Is it possible to reach the same result in another way?

Sample Data to test:

  • 66-4 Parkhurst Rd, Chelmsford MA 1824
  • 591 Memorial Dr, Chicopee MA 1020
  • 55 Brooksby Village Way, Danvers MA 1923
  • 137 Teaticket Hwy, East Falmouth MA 2536
  • 42 Fairhaven Commons Way, Fairhaven MA 2719
  • 374 William S Canning Blvd, Fall River MA 2721
  • 121 Worcester Rd, Framingham MA 1701
  • 677 Timpany Blvd, Gardner MA 1440
  • 337 Russell St, Hadley MA 1035
  • 295 Plymouth Street, Halifax MA 2338
  • 1775 Washington St, Hanover MA 2339
0

There are 0 best solutions below