Ashley Sanders writes:
>> Here's my use case:
>>
>> foo.fileName =/substring=-5 .html
>>
>> Find all filenames that end in '.html', which can't otherwise be
>> accomplished unless you can start a number of characters back from
>> the end.
>
> If that's why you want, then why not create an operator or modifier
> such as "ends-with", rather than creating an obscure and error prone
> substring modifier?
That's pretty much what Rob has done, except that instead of a limited
"ends-with" modifier, he's made a more general "count backwards from
the end" modifier. And it is spelled "-". Any cosmetic resemblance
to negative numbers should be ignored: the use of the "-" character is
arbitrary. In fact, we could use (say) "$" instead, like this:
foo.fileName =/substring=$5 .html
So that all of the string except the first and last characters would
be written:
foo.fileName =/substring=2,$1 ark_side_of_the_moo
_/|_ ___________________________________________________________________
/o ) \/ Mike Taylor <[log in to unmask]> http://www.miketaylor.org.uk
)_v__/\ "This machine is a piece of GAGH! I need dual 600MHz Pentium
processors if I am to do battle with this code!" -- Klingon
Programming Mantra
|