Check if string contains substring surrounded by numbers

Hi,

I have a process that generates strings.
I would like to check each string and search for substring which contains the letter 'E' surrounded by numbers (both sides of the letter 'E').

few examples:

AA4E7012A2 - contains E surrounded by numbers
FE18274012 - does not contain E surrounded by numbers
49EFCE8FC3 - does not contain E surrounded by numbers
F3DCD73EA1 - does not contain E surrounded by numbers
957FF564E7 - contains E surrounded by numbers

I tried few options of using the next check without much success: ^[[:digit:]]*[[:alpha:]]*[[:digit:]]*$

please advise.

Thanks,
YE

[[:digit:]]E[[:digit:]]
2 Likes

Please use code and icode tags.
Also, shell, operating system and utilities which are to be used would help us help you.
Your coding effort is also encouraged.

Here is gnu grep from linux box

grep -E "+[0-9]E[0-9]+" input

Where input is a file which contains your example data.

Hope that helps
Regards
Peasant.

What happens when there is one E surrounded by numbers and one that is not?

Out of curiosity, is this significant? : The letters are between A and F. Are you certain those are not hexadecimal numbers ?