I have a large string like this:
string = {"text, 1998, TEXTDATA, text, 2007, NEXTTEXTDATA"};
Now I want to extract TEXTDATA and NEXTTEXTDATA. I tried to use StringCases
and Shortest
in combination with DigitCharacter
like this:
StringCases[string, Shortest[DigitCharacter .. ~~ ___ ~~ ", "]]
but this of course yields only
(* {{"1998, ", "2007, "}} *)
So either there is a way to combine DigitCharacter
with the FIRST comma (and then probably Shortest
would work) or there is a way without Shortest
?