On 07/12/2008 11:16, Johnny Rosenberg wrote:
I have tried almost everything, but I just can't get this particular search
to find anything (I know it's there to find, because I can find it
manually…).

The search string I want to find looks like this, kind of:

The text "</configItem>", sometimes followed by a space but not necessary.
Then a paragraph break, then zero or more spaces and then the text
"</layout>".

Here's an example, I don't know if all spaces etc makes it through all the
email systems on the way, though:

      <languageList><iso639Id>swe</iso639Id></languageList>
    *</configItem>
  </layout>
*  <layout>

Those bold characters is supposed to be found in this case.

I checked the Regular expression check box, of course. One of the things
that I tried was the following:

</configItem>[:space:]*$[:space:]*</layout>

It seems like whenever I put something after the $, it won't find anything.
So obviously that's not hte way to go, but what is?

J.R.
I am fairly certain that Regular Expressions (REs) can't be used to search across paragraph boundaries. I believe that this is true of pretty much any editor that supports REs. (For plain text editors substitute "line ends" for "paragraph boundaries".)

So you need a kludge.

1. Use REs to change *all* the paragraph marks in your text to some (preferably short) string that you are sure doesn't occur anywhere in that text:
a) in the Search box enter "$" without the quotes
b) in the Replace box enter the "magic" string, for example "zxcvb", without the quotes.

2. Now use REs to find your pattern but with the "$" replaced by our magic string, so "</configItem>[:space:]*zxcvb[:space:]*</layout>", again without the quotes.

3. Having found the strings you want and done to them whatever you want, use REs to change *all* the magic strings back to paragraph marks:
a) In the Search box enter "zxcvb" - no quotes
b) In the Replace box enter "\n"

Of course you could do step 2 & 3 for each separate instance by only finding the "next" instance of your pattern, working on it and changing its magic string back to a paragraph mark:
a) change all paragraph marks to magic string
b) do
      find next pattern including magic string
      make any changes in this neighbourhood
      change this magic string to a paragraph mark
  until done

The problem becomes *much* more complicated if the two parts of your pattern can be separated by multiple lines each of which might contain text; I haven't tried to solve that problem because you didn't pose it ;-) I'm not at all sure that I can :-(

--
Harold Fuchs
London, England
Please reply *only* to [email protected]

Reply via email to