Brett S Hallett wrote:
Your regex can be simplified, because within a character class the pipe
character means "match a pipe character" and not "or". Additionally, you
do not have to escape the quotes, so the resulting regex would be /["']/.
That's not totally correct. The last set isn't missing, but the 3rd set
is empty. For easier debugging try:
As mentioned before: That isn't the problem. Your are searching for a
regex that splits a line into tokens. Some of the tokens are enclosed in
quotes and some are not. Both tokens can contain whitespace. I am not
sure, if your problem can easily be solved by using a single regex. If
you can, you should change your input format.
Is the first token always enclosed in [<>] characters? Are the following
tokens always enclosed in quotes? Then it would be easier to split the
line, but you still would need more than one split call. Maybe then it
would fit in a single call of scan?