regex url validator?
Pi Digital
sean at pidigital.co.uk
Tue Oct 23 20:36:40 EDT 2018
Hi Alex
> Alex wrote:
> 1. the syntax diagram is (I think) wrong (or at least misleading) ....
>
>> filter [{lines | items | keys | elements} of] *filterSource* {with | without | [not] matching} [{wildcard pattern | regex pattern}] *filterPattern* [into *targetContainer*]
>>
> in particular, the bit that says .... [{wildcard pattern | regex pattern}] ....
>
> It implies that it is optional to have anything there - and that if you do, then it can be either one or the other. Nothing there indicates that the alternatives are
>
> alternative one: "wildcard pattern" or nothing,
> alternative two: "regex pattern".
>
> Maybe it could be
>
> filter [{lines | items | keys | elements} of] *filterSource* {with | without | [not] matching} {[wildcard pattern] | regex pattern} *filterPattern* [into *targetContainer*]
>
> (i.e. moving the option [...] inside the alternate {...} - which I think gives equivalent possibilities, but makes it clearer which is which; clearer at least to me :-)
The problem there is that it is an option. The default if nothing is expressed is that it is a wildcard pattern. So
filter lines of x with “a”
is the same as
Filter lines of x with wildcard pattern “a”
However, specifying regex pattern explicitly ensures that the filterpattern is handled as a regex.
> 2. Explicitly say in the description that the phrase "regex pattern" is required if the filterpattern is to be interpreted as a regex, while the alternative "wildcard pattern" is optional, and is the default, used if neither of those phrases occurs.
This is bang on the money and should definitely be added to ensure there is never any confusion. I’ll implement right away.
Thanks
Sean
More information about the use-livecode
mailing list