Multiline find/replace broken in 9.3?

Having trouble installing Oxygen? Got a bug to report? Post it all here.
sampablokuper
Posts: 22
Joined: Tue Apr 08, 2008 1:41 pm

Multiline find/replace broken in 9.3?

Post by sampablokuper »

Hi there,

I'm mid-way through editing an XHTML document with oXygen 9.3. I've included an excerpt of that document below for illustration.

I want to find blocks between pairs of " entities, and to replace those entities with strings conforming to the q tag fix described at A List Apart.

For this, I've been using oXygen's Find/Replace dialog box (not in multifile mode), with the following settings:

Text to find: "(.+?)"
Replace with: &lsquo;<q>$1</q>&rsquo;
Direction: Forward
Scope: All
Case sensitive: false
Search also in tags: true
Regular expression: true
Wrap around: true

In the paragraph below, this only matches the string,

Code: Select all

", he told Lyell at the end of 1859, "
. However, I believe it ought to match many more strings, e.g.:

Code: Select all

"bitter
opponents"

Code: Select all

" <em>per</em>
version"

Code: Select all

"When I was in
spirits"
and

Code: Select all

"I sometimes fancied that
my book w <sup>d</sup> be successful; but I never even built a castle-in-the air of such
success as it has met with; I do not mean the sale, but the impression it has made on
you (whom I have always looked at as chief judge) & Hooker & Huxley. The
whole has <em>infinitely</em> exceeded my wildest hopes.&mdash;"
Am I mistaken?

Here is the excerpt:

Code: Select all

<p>The two years covered in this volume were, without doubt, the most momentous of
Darwin's life. From a quiet rural existence filled with steady work on his
&lsquo;<q>big book</q>&rsquo; on species, he was jolted into action by the arrival of an
unexpected letter from Alfred Russel Wallace. This letter led to the first announcement
of Darwin's and Wallace's respective theories of organic change at the
Linnean Society of London in July 1858 and prompted the composition and publication, in
November 1859, of Darwin's major treatise <em>On the origin of species by means
of natural selection</em>. By the end of 1859, Darwin's work was being
discussed in publications as diverse as <em>The Times</em> and the <em>English
Churchman</em>, and Darwin himself was busy as never before: answering letters,
justifying and explaining his views to friends, relations, and "bitter
opponents"; compiling corrections for a second and then a third edition of his
book; and enthusiastically negotiating for possible American, French, and German
editions. In particular, he rejoiced in the conversion (" <em>per</em>
version" as he jokingly called it) to his views of close friends like Charles
Lyell, Joseph Dalton Hooker, and Thomas Henry Huxley, who each, in his own way, had
hesitated in relinquishing orthodox concepts of creation. "When I was in
spirits", he told Lyell at the end of 1859, "I sometimes fancied that
my book w <sup>d</sup> be successful; but I never even built a castle-in-the air of such
success as it has met with; I do not mean the sale, but the impression it has made on
you (whom I have always looked at as chief judge) & Hooker & Huxley. The
whole has <em>infinitely</em> exceeded my wildest hopes.&mdash;" (letter to
Charles Lyell, 25 [November 1859]). This transformation in Darwin's personal
world and the intellectual turmoil that his writings precipitated are dramatically
conveyed by the letters collected here.</p>
Many thanks in advance for your help,
Sam
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Multiline find/replace broken in 9.3?

Post by sorin_ristache »

Hello,
sampablokuper wrote:For this, I've been using oXygen's Find/Replace dialog box (not in multifile mode), with the following settings:

Text to find: "(.+?)"
Replace with: &lsquo;<q>$1</q>&rsquo;
Direction: Forward
Scope: All
Case sensitive: false
Search also in tags: true
Regular expression: true
Wrap around: true
Your expression does not match multiline strings because the special character . from (.+?) does not match line terminators in a regexp. For matching also the multiline strings you have to use ((.|\n)+?).


Regards,
Sorin
sampablokuper
Posts: 22
Joined: Tue Apr 08, 2008 1:41 pm

Re: Multiline find/replace broken in 9.3?

Post by sampablokuper »

Ah, ok, I was thinking that dots matched newlines. Thanks for the clarification!
Post Reply