how to select a sub-range

M

mjim79

Hi!

I need to select a sub-range from a document to copy in another. The
sub-range to select is delimited by xml tag... (<myTag>...the sub-range to
copy...</myTag>).

What text should be the findtext (range.find.execute)? I'm not familiar
wiht regular expresions...

It is posible to select the subrange to make a selection.copy?

Thanks!
Ragards,
 
D

David Horowitz

Hi. I *think* you're looking for text in your Word document that's in XML
form, which is a little unusual, but assuming that's the case, you might
have something like this:

------------------
<body>
<p>This is the text of a Word docuument.</p>
<myTage>This is in the myTag tag.</myTag>
<hr/>
<p>That's it!</p>
</body>
------------------

And I think you want to use wildcards to find the text contained in the
myTag tag.
You would *think* you would use:
<myTag>*</myTag>
and you'd be close, but the < and > have special wildcard meanings, so you
need to escape them with a backslash:
\<myTag\>*\</myTag\>
That should work.
Remember, Wildcards must be turned on for this to work.
Now, to take it a step further, if you want to do some sort of replace
operation, you can enclose separate "tokens" of the find expression in
parentheses and then refer to them in the replace expression. For example,
if you want to change the <myTag> tags to <myNewTag> tags, you might use
this Find expression:
(\<myTag\>)(*)(\</myTag\>)
Notice this makes three separate Find tokens surrounded by parentheses.
Then your Replace expression would be:
<myNewTag>\2</myNewTag>
This puts <myNewTag> followed by the 2nd token, which corresponds with (*),
followed by </myNewTag>.
Note you don't need to use the backslashes in the Replace expression.
Hope this helps you on your path.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top