I want to retrieve the consecutive 8 digits out of a string.
"hello world,12345678anything else"
should return 12345678
as result(the space in between is optional).
But this should not return anything:
"hello world,123456789anything else"
Because it has 9 digits,I only need 8 digits unit.
Try
'/(?<!\d)\d{8}(?!\d)/'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With