Extract digits from a text object
Posted: 2021-07-18 15:15:47
Very basic question but this macro language is confusing to me.
I have a text object, $ref, which contains a string, "Lesson 29". I want to extract the digits (which can be n to nnn) into another text object, call it $refNum. How do I do that? Is there a simple way to use some kind of "find" command with "\d+"? I looked at "substring", having been used to "substr" in another program language, but I can't understand the documentation. A find with regex would be better since it would trap the digits regardless of length.

I have a text object, $ref, which contains a string, "Lesson 29". I want to extract the digits (which can be n to nnn) into another text object, call it $refNum. How do I do that? Is there a simple way to use some kind of "find" command with "\d+"? I looked at "substring", having been used to "substr" in another program language, but I can't understand the documentation. A find with regex would be better since it would trap the digits regardless of length.