Hi Alex, Thanks for your reply.
> On 14. nov. 2014, at 17.37, Alexander Burger <a...@software-lab.de> wrote: > > Hi Jon, > >> Is it possible to write a 'match' expression that will recognize >> (Java) strings like these two? >> >> @foo("bar") >> whitespace@someother("text") > > Usually 'match' is not the optimal way to operate on strings. What is > the situation where you need this? > I’m just scanning .java files in a big project, trying to spot "text" literals that should have been coded for localization, and the literals in Java annotations of the form @foo("bar") are ones that I just want to skip. Efficiency is not a big thing here. I will probably do as you suggest below, checking for the @ manually. /Jon > If you parse this from a file or stream, it is usually easier and more > efficient to use 'from', 'till' and/or 'echo', because it works directly > on the input data without building s-expressions first. > > >> I don’t know how to escape the @ so that it will not be handled as a >> wildcard symbol. > > 'match' doesn't support an escape mechanism. You can check for the "@" > manually: > > (let Str "@foo(\"bar\")" > (use (@A @X @Z) > (and > (match '(@A "(" @X ")" @Z) (chop Str)) > (member "@" @A) > ... do something ... > >> The "whitespace" in the second line doesn’t necessarily have to be >> whitespace. The important thing is that the @ isn’t always in pos. 1. > > So this can be handled with the 'member' call above. > > > Operating on the characters is also possible in many ways, e.g. with > 'split': > > (let L (split (chop "whitespace@someother(\"text\")") "@" "(" ")") > ... operate on the fragments with list functions ... > ("w" "h" "i" "t" "e" "s" "p" "a" "c" "e") > ("s" "o" "m" "e" "o" "t" "h" "e" "r") > ("\"" "t" "e" "x" "t" "\"") > > ♪♫ Alex > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe PԔ � &j)m����X�����zV�u�.n7�