nwsapi icon indicating copy to clipboard operation
nwsapi copied to clipboard

logicalsel Rexexp selects incorrect values since 2.2.3

Open paulbrimicombe opened this issue 2 years ago • 5 comments

In version 2.2.3, the logicalsel regular expression changed from:

logicalsel: '(is|where|matches|not)\\x28\\s?([^()]*|[^\\x28]*\\x28[^\\x29]*\\x29)\\s?(?:\\x29|$)',

to

logicalsel: '(is|where|matches|not)\\x28\\s?([^\\[]*\\[[^\\]]*\\]|[^\\(]*\\([^\\)]*\\)|[^()]*)\\s?(?:\\x29|$)',

When matching a selector of the form:

[EDIT: this example was incorrect in the original bug report but should now be correct — apologies for the mistake!]

div:not(.main) a:not([class=unstyled-link]) {
    text-decoration: underline;
}

The old version would match not(.main) and not([class=unstyled-link]) separately but the new version matches the whole of not(.unstyled-links) a:not([class=unstyled-link)] as a single capture group. The [] in the second selector appears to be the problem — if I rewrite the second part of the selector as a:not(.unstyled-link) everything works as expected.

paulbrimicombe avatar May 12 '23 14:05 paulbrimicombe

@paulbrimicombe it looks like the latest change I did to the Regular Expression solves for this selector and others too. Have you tried latest Github nwsapi commits ?

dperini avatar May 25 '23 12:05 dperini

@paulbrimicombe it looks like the latest change I did to the Regular Expression solves for this selector and others too. Have you tried latest Github nwsapi commits ?

@dperini the code in master definitely looks correct (comparing the matches made by the old and new regular expressions) but without a pre-release published to NPM I wouldn't be able to tell for sure!

paulbrimicombe avatar May 26 '23 07:05 paulbrimicombe

@paulbrimicombe @ALL See issue #89 and commit 01216f85b9989ce0f1d5b0ee5ce28bb88ea8aaa3 for a new regular expression that should fix remaining failure cases.

dperini avatar Jun 18 '23 17:06 dperini

Hi @dperini , I've just checked v 2.2.5 and that looks good for us. It's harder to tell with the newer version because it's unreleased and I'd have to go in and hack node_modules to test it. Any chance of a pre-release published to npm?

paulbrimicombe avatar Jun 19 '23 09:06 paulbrimicombe

@paulbrimicombe I need to release more fixes in 2.2.6 but it will be done soon.

dperini avatar Jun 28 '23 10:06 dperini

@paulbrimicombe more fixes were committed to the "nwsapi" repository. Keep trying and report any issue you might find. Thank you for your feedback

dperini avatar Apr 30 '24 20:04 dperini