data conversion strangeness
Alex Dean
alex at crackpot.org
Fri Jun 16 22:06:43 MST 2006
On Jun 16, 2006, at 9:08 AM, Craig White wrote:
> On Fri, 2006-06-16 at 12:03 -0400, A LeDonne wrote:
>> On 6/16/06, Craig White <craigwhite at azapple.com> wrote:
>>> I only brought in Notepad.exe because of something that I can't
>>> explain
>>> within openoffice.org... I could use regular expressions to use
>>> "\n" as
>>> a [return/linefeed] in OOo's 'Replace' but couldn't figure out
>>> how to
>>> 'Find' "\n" - I finally gave up. It does have a really nice
>>> feature '^$'
>>> to find blank lines though so I had to shift my thinking and now
>>> I am
>>> working.
>>>
>>> Craig
>>
>> Another option (though I understand that you're past this): I was
>> able
>> to use $ by itself to match line endings in OOo's Replace with RegEx.
> ----
> duh - that was an important piece of info there...I guess that's why I
> asked/responded as I did because I was frustrate at not being able to
> 'find' the line ending but able to 'replace' with them.
^, $, etc. are position assertions rather than characters. They seem
similar to things like \n or \r, but they're not. Various editing
tools seem to handle attempts to find/replace the positions in non-
intuitive ways, at least as I've seen.
I always thought '^$' would find all blank lines, but in some
programs it finds nothing at all, because blank lines have a newline
character, so you have to use '^\n$' as the regular expression.
I'm pretty sure you'll get more predictable results if you always
include some real characters. An expression built only out of
positional assertions will be a frustrating little beast. (That's
how it was for me, anyway.)
alex
.
More information about the PLUG-discuss
mailing list