On 6/17/06, Alex Dean wrote: > > On Jun 16, 2006, at 9:08 AM, Craig White wrote: > > > On Fri, 2006-06-16 at 12:03 -0400, A LeDonne wrote: > >> 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 (some references below for archive completeness re: matching newlines in OpenOffice) Absolutely agreed - you start getting very much regex-engine-dependent behavior when using regexs comprised solely of assertions. I was just describing what happens to work in that one particular engine. In short, the OO.o regex engine is known to be flaky about newline... it treats $ as a positional assertion UNLESS it has nothing to the left, with the possible exception of the ^ assertion, in which case it matches the newline. http://www.oooforum.org/forum/viewtopic.phtml?t=27643 http://www.oooforum.org/forum/viewtopic.phtml?t=32963 There's an LGPL'ed open source workaround, though: IannzFindReplace.sxw from http://homepages.paradise.net.nz/hillview/OOo/ -A --------------------------------------------------- PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us To subscribe, unsubscribe, or to change you mail settings: http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss