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

Match expressions for license templates fail when using white space #130

Open
goneall opened this issue Dec 21, 2017 · 5 comments
Open

Match expressions for license templates fail when using white space #130

goneall opened this issue Dec 21, 2017 · 5 comments

Comments

@goneall
Copy link
Member

goneall commented Dec 21, 2017

When there is a white space used in a pattern for the <<var expression in a license template, it will sometimes not match.

This is due to the license text being tokenized as part of the match.

It fails specifically if the space is at the very end of text to be matched. The space will be trimmed off of the comparison text causing the failure.

A workaround is to use the optional keyword (e.g. " |" -> " ?|").

@wking
Copy link
Contributor

wking commented Dec 26, 2017

A workaround is to use the optional keyword (e.g. | ?|).

Can't we fix this here (vs. in license-list-XML) by adjusting the license regexps if necessary? I'd rather not break the XML to work around a tooling issue.

@goneall
Copy link
Member Author

goneall commented Dec 27, 2017

Can't we fix this here (vs. in license-list-XML) by adjusting the license regexps if necessary? I'd rather not break the XML to work around a tooling issue.

I would also like to fix this in the tools, however, it looks like a major design change that would cause a significant performance problem.

If you have an idea how to fix without a major design change, please propose the details as a comment or do a PR.

@wking
Copy link
Contributor

wking commented Dec 27, 2017

If you have an idea how to fix without a major design change...

For the handful of license-list-XML cases, you could replace | with {1}| in regexps before compiling them. That won't always be right, but it would be right for the current license-list-XML cases.

@goneall
Copy link
Member Author

goneall commented Dec 27, 2017

In the case where you have white space involved in the matching, I would prefer to update the license list XML matches to include the words surrounding the white space in the match. It is more precise and efficient.

For examples, to match this -and or this-and you could have a pattern <alt match="this-and|this and"... It could also be generalized to <alt match="this-and|this\sand"...

@wking
Copy link
Contributor

wking commented Dec 27, 2017 via email

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

2 participants