0

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
tripleee
  • 175,061
  • 34
  • 275
  • 318
Raj
  • 13
  • 3
  • Are you sure that's an error message? Anyway, different tools support different regex dialects. – tripleee Dec 23 '22 at 13:54
  • thank you. I just corrected the error message – Raj Dec 23 '22 at 13:57
  • Your pattern is almost like `^\d.*\d$`: matches a line/string starting with a digit and ending with a digit. – Wiktor Stribiżew Dec 23 '22 at 14:33
  • do you have any recommendation to rewrite this regex ? – Raj Dec 23 '22 at 17:30
  • Your test data is strange. U.S addresses end in either 99999 or 99999-9999, i.e. 5 digits or 5 digits followed by '-' followed by 4 digits. – Booboo Dec 31 '22 at 16:56
  • You can use the below sample data for the test, but do you have any regex for office365 where we can configure the U.S address regex in the single group? 374 William S Canning Blvd, Fall River MA 27212-3253 – Raj Jan 03 '23 at 13:58

0 Answers0