Is it possible to use a StringExpression as a pattern for an argument? I.E. something like
foo[chars__~~ WordCharacter.. ~~ num:NumberString] := {chars, num};
At the moment, I'm using a somewhat more convoluted function like
bar[str_String /; StringMatchQ[str, chars__~~ WordCharacter.. ~~ num:NumberString]] :=
StringCases[str,
chars__~~ WordCharacter.. ~~ num:NumberString :> {chars, num}][[1]];
StringSplit
and a rule, but I plan on using a fair bit of string manipulation (Splitting things into different chunks and reordering/manipulating them in different ways), and was hoping there was a very simple way to accomplish things like this. $\endgroup$