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}


1 Like

It selects both the numbers


I want only the 8 digit numbers


try below regex patterns.



Thank you and it also not work as expected


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


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

Okay Then Use This


It Will Definetly work

Thank you. It works perfectly