Hi there,
I have some files named as below:
input :
1. ABC_123r_EfsrTerhvhb
2. ABC_123456y_OUTERRG
3. ABC_ef567_itreqwrtohg
The "ABC_" is fixed in the starting name of the file. I need to fetch string (numeric value or alphabets) which is between first occurrence of underscore and second occurrence of underscore. The string can contain numeric values or alphabets.
After extracting the desired string from the filename, I need to check whether it is of length = 4 and it should have only numeric values.
Here's two ways, one with Regex and one with string functions.
Apologies I have made some mistake while writing the filenames. The filenames is as below:
input :
1. ABC_123r_EfsrT_erhvhb
2. ABC_123456y_OUTE_RRG
3. ABC_ef567_itre_qwrtohg
I want below output:
1. 123r
2. 123456y
3. ef567
then need to check length = 4 and all digits are numeric values.