Difference between revisions of "Talk:Documentation/How Tos/Regular Expressions in Writer"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (backreferences?)
m
Line 54: Line 54:
 
See my comment under the same heading in [[Talk:Documentation/How Tos/Regular Expressions in Calc]]
 
See my comment under the same heading in [[Talk:Documentation/How Tos/Regular Expressions in Calc]]
 
--[[User:Hgreenhough|Hgreenhough]] 12:05, 13 December 2007 (CET)
 
--[[User:Hgreenhough|Hgreenhough]] 12:05, 13 December 2007 (CET)
 +
 +
 +
== Backreferences ==
 +
 +
http://www.openoffice.org/issues/show_bug.cgi?id=15666#desc100
 +
describes a glitch in the new backreference feature. It does not seem to have been reported as a seperate issue, so may not get picked up. One to test for!
 +
<pre>Capitalize words beginning with h:
 +
s/\<h([a-z]+)/
 +
r/H$1/
 +
Match case = Yes
 +
 +
Starting text:  He heard quiet steps behind him.
 +
Expected result: He Heard quiet steps behind Him.
 +
Actual result:  He H$1 quiet steps behind H$1</pre>
 +
 +
 +
 +
http://qa.openoffice.org/issues/show_bug.cgi?id=84922
 +
describes a situation where backreferences do not work in find, although I can't follow it myself.

Revision as of 12:24, 3 January 2008

References

Some of the matters arising with regex can be found in the OOo archives:

bugs:

http://www.oooforum.org/forum/viewtopic.phtml?t=39589

http://www.oooforum.org/forum/viewtopic.phtml?t=64265&highlight=regular

http://www.oooforum.org/forum/viewtopic.phtml?t=61200&highlight=regular


discussion:

http://www.oooforum.org/forum/viewtopic.phtml?t=8665&highlight=regular

http://www.oooforum.org/forum/viewtopic.phtml?t=61857&highlight=regular


issue:

http://qa.openoffice.org/issues/show_bug.cgi?id=15666 (now RESOLVED FIXED)


Examples

This is probably too arcane, but here's a discussion on the black art of finding octal, decimal, & hexadecimal numbers in Writer http://www.oooforum.org/forum/viewtopic.phtml?t=66319

Octal   \<0[0-7]*\>
Decimal \<[1-9][0-9]*\>
Hex     \<0x[A-Fa-f0-9]+\>


Workarounds

In at least some versions of Linux it is possible to use unicode input to directly type a newline (line feed / soft line break/ U+000A) in the "Replace with" input box. There are no reports so far of this working on any other OS.

http://user.services.openoffice.org/en/forum/viewtopic.php?p=2842#p2842

This means that for some people it is possible to insert a newline using Find & Replace.

http://en.wikipedia.org/wiki/Unicode#Input_methods

http://www.fileformat.info/tip/microsoft/enter_unicode.htm

http://www.fileformat.info/info/unicode/char/000a/


Versioning of regex howto in future

See my comment under the same heading in Talk:Documentation/How Tos/Regular Expressions in Calc --Hgreenhough 12:05, 13 December 2007 (CET)


Backreferences

http://www.openoffice.org/issues/show_bug.cgi?id=15666#desc100 describes a glitch in the new backreference feature. It does not seem to have been reported as a seperate issue, so may not get picked up. One to test for!

Capitalize words beginning with h:
s/\<h([a-z]+)/
r/H$1/
Match case = Yes

Starting text:   He heard quiet steps behind him.
Expected result: He Heard quiet steps behind Him.
Actual result:   He H$1 quiet steps behind H$1


http://qa.openoffice.org/issues/show_bug.cgi?id=84922 describes a situation where backreferences do not work in find, although I can't follow it myself.

Personal tools