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

[Question] How Do Regular Expressions Work When Excluding Operator Filters? #520

Closed
FloatingSunfish opened this issue Jul 29, 2021 · 3 comments

Comments

@FloatingSunfish
Copy link

FloatingSunfish commented Jul 29, 2021

The cr-filter-operators section of the documentation shows the following examples:

"core/ReplaceComparisonOperator_Is(Not)?_(Not)?(Eq|[LG]tE?)",
"core/ReplaceComparisonOperator_(Not)?(Eq|[LG]tE?)_Is(Not)?",
"core/ReplaceComparisonOperator_[LG]tE_Eq",
"core/ReplaceComparisonOperator_[LG]t_NotEq",

Because regular expressions are optional, and the operator's full name is already included, how are the regular expressions affecting the configuration?

You can provide an explanation for just one of the examples.

@abingham
Copy link
Contributor

I'm not entirely sure I understand the question, but I've updated the docs to hopefully make things clearer.

Because regular expressions are optional

They're not. Every string in that list is treated as a regular expression, if it's a very simple regex that only matches a single string.

the operator's full name is already included, how are the regular expressions affecting the configuration?

This is where I'm not sure I understand. The filter looks at the operator name for each WorkItem, and if that operator name matches any of the regular expressions the list, that WorkItem is skipped. The use of regular expressions allows you to match on many operator names with a single pattern.

If the documentation changes clarify things, go ahead and close this. Thanks!

@FloatingSunfish
Copy link
Author

FloatingSunfish commented Jul 30, 2021

@abingham
I assumed regular expressions were optional because of what you said here:

>Yes, that looks correct. Regular expressions are an option, not a requirement. In your case of excluding a single operator, what you've done is fine.

Perhaps I misunderstood what you meant to say.
In any case, after seeing the updated section in the docs, I think everything is clear to me now. 🙂

But before we close this issue, could you clarify what you meant in the quote above?

@abingham
Copy link
Contributor

I was just being sloppy with my language. What I meant by "regular expressions are an option" is that you don't need to use any "special" regular expression syntax in those strings; you can just match on a simple string without repetition operators, choice operators, etc.

So just to restate things: all of the strings in that list are used as regular expressions, and simple strings without fancy regex features are perfectly valid regular expressions.

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