Simultanious Find and Replace of Tag Pairs
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 1
- Joined: Wed Jan 31, 2018 5:08 pm
Simultanious Find and Replace of Tag Pairs
Post by EmelineDehnReynolds »
Hello Good People of Oxygen,
Is it possible to replace the opening and closing tag at the same time, i.e., change <p>[text]</p> to <item>[text]</item> in one fell swoop within a portion of the document? If so how?
I know I could replace the opening then the closing tags across the text by doing first <p> -> <item> and then </p> -> </item>, but since I'm only doing small chucks of text at a time this is quite time-intensive. I don't want to work with find & replace over the entire scope of the document because there are some <p>[text]</p> tag pairs I'd like to keep as they are.
Thank you,
Emeline Dehn-Reynolds
Is it possible to replace the opening and closing tag at the same time, i.e., change <p>[text]</p> to <item>[text]</item> in one fell swoop within a portion of the document? If so how?
I know I could replace the opening then the closing tags across the text by doing first <p> -> <item> and then </p> -> </item>, but since I'm only doing small chucks of text at a time this is quite time-intensive. I don't want to work with find & replace over the entire scope of the document because there are some <p>[text]</p> tag pairs I'd like to keep as they are.
Thank you,
Emeline Dehn-Reynolds
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: Simultanious Find and Replace of Tag Pairs
Hi,
If you specifically just want to change both tags of (basically rename) an element, you can right click on either of the start or end tags and pick Refactoring > Rename Element.... In the Rename dialog you can control if this will be done on just the current element, all its siblings or all elements with the same name in the entire document.
If you want to use the Find/Replace tool, you can use a regular expression.
Find: <p>(.*?)</p>
Replace with: <item>$1</item>
Options > [x] Regular expression
Basically $1 points to the 1st capturing group (first group of parenthesis).
If you have nested p elements it's a bit more complicated, but I expect this isn't the case.
Regards,
Adrian
If you specifically just want to change both tags of (basically rename) an element, you can right click on either of the start or end tags and pick Refactoring > Rename Element.... In the Rename dialog you can control if this will be done on just the current element, all its siblings or all elements with the same name in the entire document.
If you want to use the Find/Replace tool, you can use a regular expression.
Find: <p>(.*?)</p>
Replace with: <item>$1</item>
Options > [x] Regular expression
Basically $1 points to the 1st capturing group (first group of parenthesis).
If you have nested p elements it's a bit more complicated, but I expect this isn't the case.
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Return to “General XML Questions”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service