When parsing expressions, one way that I like to grab an integer delimited on the end by any nonexpandable token that is not a digit is using a count register and \afterassignment. So the code looks like:
\newcount\mycount
\def\mycommand#1{\mycommand@#1\nil}
\def\mycommand@{\afterassignment\mycommand@@\mycount=}
\def\mycommand@@#1\nil{integer: "\the\mycount", rest: "#1"}
so then \mycommand{12 and text} produces integer: "12", rest: "and text". For an example of why I would want to do this, see my answer here: https://tex.stackexchange.com/a/470171/23866. The asker wanted a command that takes as argument a specification like
column 10 to 12 row 3 to 5
column 10 row 7
row 3 to 5
Is there a sanctioned latex3 approach to this?
\def\grab column#1to#2row#3to#4\endgrab{...}– Henri Menke Jan 15 '19 at 02:28