how do I remove letters in front of numbers on an Arduino, for example I have it written "test123" to become "123" then I also want the reverse "test123" to become "test" so later it will be like this
This will look for a word of one or more (+) letters [a-zA-z] at the beginning (the caret) of the text followed by one or more (+) digits (`[0-9]. Anything following that will be ignored.
The result is grouped so you will e.g. get 'test' and '123'.
I want to retrieve the number from the text "test123" and I also want to be able to retrieve the text "test" but when I type test123f it will be considered incorrect
It doesn't, unless you are always removing a fixed word length. The test case that you keep presenting is not clear enough. What do you actually need to do?
I want to make a word in the serial monitor to save data, when I type test123 or test321 then the numbers 123 and 321 will be saved because what we read is test but when I just type test, test123f, testh123 then in the serial monitor there will be an error written
Arduino doesn't support regex natively. As others have been trying to tell you, there are better and cheaper ways to achieve your goals, should you decide to actually say what you are trying to do.