Conditional Regex in Replace not working?
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 3
- Joined: Mon Jun 16, 2014 6:08 pm
Conditional Regex in Replace not working?
I'm trying to use a conditional regular expression in the Replace part of the Find/Replace dialog. I can't get it to work--it returns string literals rather than evaluating the condition. I'm using 15.1, which I understood from the documentation supports Perl 5 regex, so I'm not sure what I'm missing.
For example,
Find:
Replace:
replaces all instances of "box" with the string "box(?(1)es)".
Any pointers would be much appreciated!
For example,
Find:
Code: Select all
(box)
Code: Select all
$1(?(1)es)
Any pointers would be much appreciated!
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: Conditional Regex in Replace not working?
Hi,
The documentation is somewhat misleading. It mentions Perl 5 regular expressions because they are more commonly known, but in reality Oxygen relies on the support provided by the Java regular expression implementation from java.util.regex.Pattern, as described here:
http://docs.oracle.com/javase/6/docs/ap ... ttern.html
(Look for 'Comparison to Perl 5')
While very similar with Perl 5 regular expressions, the Pattern implementation does have some limitations, one being that it does not support conditional constructs.
I've logged an issue for the documentation department to address this mistake.
Regards,
Adrian
The documentation is somewhat misleading. It mentions Perl 5 regular expressions because they are more commonly known, but in reality Oxygen relies on the support provided by the Java regular expression implementation from java.util.regex.Pattern, as described here:
http://docs.oracle.com/javase/6/docs/ap ... ttern.html
(Look for 'Comparison to Perl 5')
While very similar with Perl 5 regular expressions, the Pattern implementation does have some limitations, one being that it does not support conditional constructs.
I've logged an issue for the documentation department to address this mistake.
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
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ 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