How to get or extract zipcode from any position and format regex?

It will get as long as valid zipcode , it will extract or check if zipcode exists in some examples below. Thank you.

Example input :
adasdasd19460-3083

output:19460-3083

Example input :
19460
output: 19460

example input :
123451234
output: 123451234

example input:
12345 1234
output : 12345 1234

current regex: ^\d{5}([-]|\s*)?(\d{4})?$

Thank you guys.

@Nathan
give a try on:
(\d| |-){5,}

1 Like

please psot the answer sir hehe

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.