filePro quiz -- edits "@"
Kenneth Brody
kenbrody at spamcop.net
Wed Aug 24 09:28:02 PDT 2011
On 8/22/2011 10:53 AM, Kenneth Brody wrote:
> Here's a quickie. No fair looking at the list's archives for examples from me.
>
> What does the "@" edits syntax do?
>
> Bonus points: write an edit that needs it.
No takers?
The "@" edits syntax matches end-of-field (including trailing spaces). It's
very useful for edits which use "{}" and "*" to match multiple "any"
characters, especially when the edit might make the text longer.
For example, to convert an apostrophe to "&39;", a less-than sign to "<",
and a greater-than sign to ">":
foo { @ | (!"'"!<&39;>) | (!"<"!<<>) | (!">"!<>>) | * }
Without the "@" syntax, the "*" within the edit will accept all trailing
spaces, making the resulting value too long to fit in the field, causing the
edit to fail. But, by putting "@" at the start of the edit, all of those
trailing spaces will be "eaten", hopefully making enough room to expand
those characters.
--
Kenneth Brody
More information about the Filepro-list
mailing list