0
Shante LaGarde 01718234
Hobby Unit
123 AB 890
Marlin, Texas 76661`

Can someone please advise expressions to extract parts of the above from Hobby Unit to the ZIP code in separate lines.

I was able to extract the first line using (?:\r\n?|\n){2}(.+) but struggling to extract the other parts of the address.

Would be using the ReGEX in WebHarvy (.NET) https://www.webharvy.com/articles/regex.html

Marc
  • 3,683
  • 8
  • 34
  • 48
pb_ng
  • 361
  • 1
  • 5
  • 19
  • So, what do you need to match exactly? You may use several groups using your own pattern - [`^(?:\r\n?|\n){2}(.+)(?:\r\n?|\n)(.*)(?:\r\n?|\n)(.*)(?:\r\n?|\n)(.*)`](http://regexstorm.net/tester?p=%5e%28%3f%3a%5cr%5cn%3f%7c%5cn%29%7b2%7d%28.%2b%29%28%3f%3a%5cr%5cn%3f%7c%5cn%29%28.*%29%28%3f%3a%5cr%5cn%3f%7c%5cn%29%28.*%29%28%3f%3a%5cr%5cn%3f%7c%5cn%29%28.*%29&i=%0d%0a+Shante+LaGarde+01718234%0d%0a+Hobby+Unit%0d%0a+123+AB+890%0d%0a+Marlin%2c+Texas+76661) – Wiktor Stribiżew Mar 14 '17 at 18:50
  • Thanks, Wiktor. I am looking to match parts of the address from the second line (excluding the empty line at first) to the ZIP – pb_ng Mar 14 '17 at 20:05
  • So I am looking to match the Unit, the street, city, state and zip – pb_ng Mar 14 '17 at 20:06
  • That does not seem feasible. How can a regex know it is not a city name but a street name? – Wiktor Stribiżew Mar 14 '17 at 20:50

0 Answers0