Reg exp for appending file extension
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 18
- Joined: Fri Feb 18, 2011 2:29 pm
Reg exp for appending file extension
Trying to change all instances of the type <xref href="myfile"> to <xref href="myfile.dita"> using Find/Replace.
If I set Xpath to //xref/@href and enter a regexp of ".*", that seems to find the required text string.
How can I then quote the found text string in the Replace With box?
\1 or $1 does not seem to work.
If I set Xpath to //xref/@href and enter a regexp of ".*", that seems to find the required text string.
How can I then quote the found text string in the Replace With box?
\1 or $1 does not seem to work.
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: Reg exp for appending file extension
Hi,
If you want to refer the entire found string, you can use \0 or $0 in the "Replace with" field.
But yes, you can also use explicit capturing groups, like you mentioned.
Regards,
Adrian
If you want to refer the entire found string, you can use \0 or $0 in the "Replace with" field.
But yes, you can also use explicit capturing groups, like you mentioned.
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
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Re: Reg exp for appending file extension
Post by chrispitude »
Sometimes for tasks a bit more complicated than this, I create a temporary refactoring operation, run it, then delete it.
It would be useful to have something like XPath/XQuery Builder, but that would let me apply XSLT templates that are not worth creating an entire refactoring operation for:
Ideally it would have scope controls and a preview functionality that could be used to fine-tune the templates, like an extra powerful find-and-replace. Just throwing the idea out there!
It would be useful to have something like XPath/XQuery Builder, but that would let me apply XSLT templates that are not worth creating an entire refactoring operation for:
Code: Select all
<xsl:template match="@href[not(ends-with(., '.dita'))]">
<xsl:attribute name="href" select=". || '.dita'"/>
</xsl:template>
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Reg exp for appending file extension
Hi Chris,
We have an internal issue:
EXM-40404 XML refactoring custom operation which calls an XSLT specified by the end user
I think my idea there was that in the main menu Tools->"XML Refactor" dialog there would be a special refactoring action named something like "Apply XSLT" which would ask you to paste the XSLT to apply as a parameter in the dialog or to maybe add a reference to an XSLT which is somewhere on disk... and maybe to allow customizing also other parameters declared in the XSLT.
Regards,
Radu
We have an internal issue:
EXM-40404 XML refactoring custom operation which calls an XSLT specified by the end user
I think my idea there was that in the main menu Tools->"XML Refactor" dialog there would be a special refactoring action named something like "Apply XSLT" which would ask you to paste the XSLT to apply as a parameter in the dialog or to maybe add a reference to an XSLT which is somewhere on disk... and maybe to allow customizing also other parameters declared in the XSLT.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Re: Reg exp for appending file extension
Post by chrispitude »
Hi Radu,
That would work! And it would allow the operation to be previewed, which is also great.
For us, the text box would be better as our use case would be a writer applying something that I give them in an email. Novice writers might be a bit more confused by temporary files, forgetting to delete them, creating them in the Git repo directory and accidentally checking them in, etc.
That would work! And it would allow the operation to be previewed, which is also great.
For us, the text box would be better as our use case would be a writer applying something that I give them in an email. Novice writers might be a bit more confused by temporary files, forgetting to delete them, creating them in the Git repo directory and accidentally checking them in, etc.
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