Re: Very Elemntary Clips
- Hi Bruce,
The discussion group's DEFACTO authority on regular expressions is
Sheri Pierce. I'll defer to her about deleting with backward assertions.
I'll answer your question about tokens (^P) vs variables (^%nl%), but
if Sheri disagrees with me about what "^P" will parse to, I suggest
you weigh her answer more heavily.
^P will usually parse the same way as ^%nl% except in two situatuations:
1. FIND and REPLACE in regular expression mode:
^P will parse as P at the begining of a line or selection,
EXCEPT if '[^P]' which will parse as ANYTHING BUT P.
^%nl% will parse as \r\n BEFORE the regular expression is parsed.
In other words, if you want a newline embedded in a string in a
regular expression, use the variable.
2. Saving text strings with an embedded newline to an INI variable:
^!SaveValue x=text line^Pnuther text line^P WORKS!
^!SaveValue x=text line^%nl%nuther text line^%nl% does NOT work.
The first will save to (in the INI file):
x="text line^Pnuther text line^P WORKS!"
and retrieving it will be what you put in.
The second example will save to
does NOT work."
When you retrieve x, you will only get the first line.
There are some exotic situations, where the two newlines may parse
differently. But even the case of assigning to the clipboard "with
tokens" will accept either as far as I've observed.
Sorry, it's a wordy subject.