-
Notifications
You must be signed in to change notification settings - Fork 58
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
Matching a non-empty pattern #357
Comments
Yeah this gets close, but the limitation is it won't match across the whitespace between
The alternative here is to use a rule to case out on non-empty matches of |
Thanks for responding! I appreciate the workaround. Feels to me like the Seems like this would be a common enough use case that it might warrant special syntax? |
I feel rather silly posting this issue, because it seems so simple that I must be overlooking something. Nevertheless, looking at the documentation here it really seems impossible to do what I want, so here goes.
The situation
I'm trying to rewrite jQuery handlers from a legacy syntax to a recommended syntax. Effectively, this is the transformation I'm trying to do:
So far, so straightforward. The problem is that jQuery methods are heavily overloaded, and so
$('#bla').submit()
also exists, but should not be rewritten.The attempt
So I'm trying the following:
And that kinda works:
Except it also catches the case I don't want to catch:
Oops!
The problem
So, it seems that I want to specify a pattern
:[b]
, such thatb
may not be empty (but I do want to preserve the lazy/automatic matching that the:[b]
syntax would do.Looking at the matching syntax table, none of the patterns achieve this:
:[[b]]
- only matches indentifiers, so will definitely not match anything of the formfunction() { ... }
:[b:e]
- sounds like it might do what I want it to do, but doesn't (apparently it doesn't like thefunction () { }
syntax?):[b.]
- doesn't match whitespaceSooo... I guess I'm looking for a non-empty variant of
:[x]
?The text was updated successfully, but these errors were encountered: