FInd a US street address in text (preferably using Python regex)

前端 未结 2 778
轻奢々
轻奢々 2021-01-13 06:35

Disclaimer: I read very carefully this thread: Street Address search in a string - Python or Ruby and many other resources.

Nothing works for me so far.

In s

2条回答
  •  庸人自扰
    2021-01-13 07:13

    I just ran across this in GitHub as I am having a similar problem. Appears to work and be more robust than your current solution.

    https://github.com/madisonmay/CommonRegex

    Looking at the code, the regex for street address accounts for many more scenarios. '\d{1,4} [\w\s]{1,20}(?:street|st|avenue|ave|road|rd|highway|hwy|square|sq|trail|trl|drive|dr|court|ct|parkway|pkwy|circle|cir|boulevard|blvd)\W?(?=\s|$)'

提交回复
热议问题