Regular Expression question

Hi I am using the following look behind
(?<=Employee No. ).*\s
This is getting all of the following “Employee No. 1201974 Last Pay $0.00”
I do not need anything after 1201974. How can I fix this?

Thank you,

@A_Learner
(?<=Employee No. )\d+(?=.*\s)

Hey @A_Learner
Try this regex

(?<=Employee No. )\d+
image

@A_Learner

(?<=Employee No. ).*(?=\s[A-Z]+[a-z]+)

Regards

Hi @A_Learner

(?<=Employee No. ).*(?= Last)

image

or

(?<=Employee No. )\d+(?=.*\s)

image

image

I hope it helps!!

1 Like

@A_Learner

If you got the solution for your question. Please mark as solution to close the thread.

Regards,

Employee number can be digits, alpha with dashes.

@A_Learner

Please try this

@A_Learner
Try this
(?<=Employee No. )[A-Za-z0-9-]+(?=.*\s)

@A_Learner Ohh then u can use this regex, IT WORKS for alphanumeric and other combinations also

(?<=Employee No. )([a-zA-Z0-9]+)
Below is the tested screenshots
image
image
image

Hope it helps!

Thank you @lrtetala

Thanks every one!!!

1 Like

Thank you @vrdabberu

Thank you @Vikas_M for the great Regex.

Thank you, @pravallikapaluri

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