https://bugs.documentfoundation.org/show_bug.cgi?id=137737
--- Comment #17 from Mike Kaganski <[email protected]> --- DoSearch in sw/source/core/crsr/findtxt.cxx uses lcl_CleanStr, which does some utter magic with special characters in the text. Namely, in case of RES_TXTATR_FTN (among other things), it replaces it with '\x7f' in the middle of the text, and drops in the end. The input looks like "He heard quiet steps behind him. That didn't bode well. Who could be following\x01 him this late at night and in this deadbeat part of town."\x01 and the output looks like "He heard quiet steps behind him. That didn't bode well. Who could be following\x7f him this late at night and in this deadbeat part of town." That latter string arrives to the TextSearch::searchForward's searchStr; and in it, the "$ matches (because the footnote anchor is dropped). Note how you will be unable to find regex 'following ' (without quotes; i.e. the word "following" followed by a space) in this text - because there is a footnote anchor between the word and the space. Personally I would simply not strip the anchor from the string; but that needs a way to treat those meta-characters specially - having some syntax for them; another option would be to remove them *everywhere*, not only at the end (so that the 'following ' example would work). But I digress. OTOH, ReplaceBackReferences (again in sw/source/core/crsr/findtxt.cxx) does not pre-process the string obtained from the paragraph using that lcl_CleanStr, and passes the original string to TextSearch::searchForward as is. Hence the difference between the results of find and replace. The replace previously relied on the "find" step limiting the endPos, and so the truncation happened inside TextSearch::searchForward using that position; and now the function sees the actual anchor following the position, and the regex does not match. Trying to find a way to "synchronize" this - likely the "natural" option is to make ReplaceBackReferences use lcl_CleanStr. -- You are receiving this mail because: You are the assignee for the bug.
