I am trying to make an regex in PCRE for string detection. The kind of strings I want to detect are abcdef001, zxyabc003. A word with first 6 characters are a-zA-Z and last two or three are digits 0-9; and this string could be anywhere in the whole text.
E.g – “User activity from server1, user id abcdef009, time 10.20am”.
How do I go about this?
Try this:
If you want to limit it to whole words, try:
\b– word boundry[a-zA-Z]{6}– six letters[0-9]{2,3}– either 2 or 3 numbers\b– word boundry