Regex Expression to find a string

Hi ,

I have to make one regex which finds id from below sample strings:

Hello world ID : 1223432342343

Hello world ID : 122343234234345

Hello world Id KEN12242342

I have one exp : ([A-Z]{3}\d{8}|\d{13,15}) , working fine on these,

but i want to add one condition in regex suppose id is 122343234234345, regex should see first numerical char in range 1-8 , if it is not , it should not match the string.

Can anyone guide me on this.

Hi @Sahil_Garg1

Try this expression

(\b[A-Z]{3}\d{8}\b)|(\b[1-8]\d{12,14}\b)

image

2 Likes

Hey,

it is working just wanted to check if i remove /b from exp , will it create any effect ?

Hi @Sahil_Garg1

if \b is removed

image

check the last match

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