My question is similiar to previous questions (see here or here), although the issue is maybe somewhat more complicated:
I have a list with strings like this:
list = {{"text1, text2, 2003, text3"},{"text1, 1994, text2"},{text1, text2, text3 2014, text4}}
I now want to extract the part of the string which contains the 4-digit Number (or in this case its a year number) AND is separated by the commas so that the outcome is:
{{"2003"},{"1994"},{"text3 2014"}}
I have tried this one:
StringCases[#,", " ~~ w : (___ ~~ Repeated[DigitCharacter, {4}]) ~~ ", " :> w] & /@ list
but this extracts always the part from the first comma in each string
many thanks for you suggestions