I am trying to get Position
work with patterns.
I have the following code:
dat = {"star", "u", "g", "r", "i", "z", "star2", "u", "g", "r", "i",
"z", "star3", "u", "g", "r", "i", "z", "star4", "u", "g", "r", "i",
"z", "Astro", "u", "g", "r", "i", "z"};
Position[dat, "star" ~~ _]
Position[dat, RegularExpression["star."]]
Netheir returns anything. What I want is to return position of "star", "star2" etc. How do I properly use patterns with Position
?
Position
works and also understand why this does not actually work $\endgroup$Position
only supports the former. The reasons for the distinction are discussed in (8945). $\endgroup$