It would help if you had a bigger sample of valid addresses.

This may be a good starting point:

(\d+)(\w*)(-)?(\d+)(\w*)(\s)([\w\s]+),\s?([\w\s]+),\s?([\w\s]+)

https://pythex.org/?regex=(%5Cd%2B)(%5Cw*)(-)%3F(%5Cd%2B)(%5Cw*)(%5Cs)(%5B%5Cw%5Cs%5D%2B)%2C%5Cs%3F(%5B%5Cw%5Cs%5D%2B)%2C%5Cs%3F(%5B%5Cw%5Cs%5D%2B)&test_string=223A-5D%20Great%20Avenue%2C%20A%20City%2C%20Planet%20Earth&ignorecase=0&multiline=0&dotall=0&verbose=0


Jo

On Sun, May 3, 2020 at 2:30 PM Shaozhong SHI <[email protected]> wrote:

> Hello,
>
> Any robust regex for searching out addresses?
>
> The text patterns is as follows:
>
> 223A-5D Great Avenue, A City, Planet Earth
>
> A robust regex needs to be constructed and tested.
>
> Any clue?
>
> Regards,
>
> Shao
> _______________________________________________
> postgis-users mailing list
> [email protected]
> https://lists.osgeo.org/mailman/listinfo/postgis-users
_______________________________________________
postgis-users mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/postgis-users

Reply via email to