Regex to retrieve 8 number

Hi Team,

I need regex to retrieve 8 digit numbers only

for ex. 12345678
1231234234234 - I want to retrieve only 12345678 Could anyone suggest please?
If i put \d{8} it selects both the numbers

Use [0-9]{8}

Regards

1 Like

It selects both the numbers

regex

I want only the 8 digit numbers

@Boopathi

try below regex patterns.

“[0-9]{8}[\S]”

“[0-9]{8}$”

Thank you and it also not work as expected

regex

This should work if the first string always ends with an end of line character:

(?=^)\d{8}$

Thank you very much. It worked and also learned a new regex today.

Okay Then Use This

^[0-9]{8}$

It Will Definetly work

Thank you. It works perfectly