I'm trying to have my NSScanner attempt to scan the following regexp: [a-zA-Z_][a-zA-Z0-9_]*, but am having difficulty.
I can try to read a-Z_ first, then try to append a-Z0-9_.
I'm wondering if there is an easier / more efficient way of doing this. Please let me know, thanks.
Clarification: I'm not trying to execute a regular expression. I'm just trying to read a string that looks like the above regexp. Something that looks similar to C-style variables. Basically, any alphanumeric word, but must not start with a number.
Clarification 2: I'm trying to have the scanner read ([] indicate each read token): "test 3" as [test, 3] "test3" as [test3] "3test" as [3, test] "_3test" as [_3test] "_3 test" as [3, test] " 3 3test" as [, 3, 3, test] " 3 test3" as [_, 3, test3]