Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AnythingBut followed by a Maybe should be ignored #23

Open
jduncanator opened this issue Aug 30, 2013 · 0 comments
Open

AnythingBut followed by a Maybe should be ignored #23

jduncanator opened this issue Aug 30, 2013 · 0 comments

Comments

@jduncanator
Copy link

When you have an AnythingBut followed by a Maybe assuming the value of Maybe isn't the value of AnythingBut then the Maybe should be ignored.

For instance the two following are semantically the same:

var verbEx = VerbalExpressions.DefaultExpression
    .StartOfLine()
    .Then( "http" )
    .Maybe( "s" )
    .Then( "://" )
    .Maybe( "www." )
    .AnythingBut( " " )
    .EndOfLine();

 

var verbEx = VerbalExpressions.DefaultExpression
    .StartOfLine()
    .Then( "http" )
    .Maybe( "s" )
    .Then( "://" )
    .Maybe( "www." )
    .AnythingBut( " " )
            .Maybe("/")
    .EndOfLine();

Both of the above should output ^(http)(s)?(://)(www\.)?([^\ ]*)$ because the AnythingBut is greedy and will capture whatever is in the Maybe.

feldrim added a commit to feldrim/CSharpVerbalExpressions that referenced this issue Nov 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant