You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When tokenizing, how to match a token only if it is the first thing in a line?
Take the following example where I am trying to match any ident followed by a colon, ONLY if it is the first thing in the line (thus the ^):
staticTextParser<Unit>Actor{ get;}=from start in Span.Regex(@"^[A-Za-z][A-Za-z0-9_]+:")selectUnit.Value;
It seems that if the line is "1 abc:" and Ignore(Span.WhiteSpace) is set, then the tokenizer consumes the first token ('1'), then ignores the white space as directed, then sees "abc:" as starting from position 0, thus matching.
But what I want is to only match "abc:" if it is the first token ... Is this possible ?
The text was updated successfully, but these errors were encountered:
dhowe
changed the title
Match a string only if it is the first thing in a line?
Match a string only if it is starting a line
Oct 7, 2018
dhowe
changed the title
Match a string only if it is starting a line
Match a string with tokenizer only if it begins a line
Oct 7, 2018
dhowe
changed the title
Match a string with tokenizer only if it begins a line
Match a string with tokenizer only if it is first token in line
Oct 9, 2018
It looks like the answer is given to you on StackOverflow. Basically it boils down to the fact that if TokenizerBuilder does not do what you want you need to build you Tokenizer yourself. Is there anything else with this question that is unresolved?
When tokenizing, how to match a token only if it is the first thing in a line?
Take the following example where I am trying to match any ident followed by a colon, ONLY if it is the first thing in the line (thus the ^):
It seems that if the line is "1 abc:" and Ignore(Span.WhiteSpace) is set, then the tokenizer consumes the first token ('1'), then ignores the white space as directed, then sees "abc:" as starting from position 0, thus matching.
But what I want is to only match "abc:" if it is the first token ... Is this possible ?
The text was updated successfully, but these errors were encountered: