Regex not working?
Oxygen general issues.
Regex not working?
regexr.com says that :
<name type="personal">\n[ \t]+<displayForm>Trust</displayForm>
should accurately match
(I'm doing a find replace "personal" with "corporate" where displayForm="trust") but it doesn't work. Any ideas why oxygen's regex is different from the web engine I'm testing on?
It is also possible this could easily be done with xquery, I can identify the attributes but I don't know how to change the value.
//mods:displayForm[text()[contains(.,'Trust')]]/ancestor::mods:name/@type correctly identifies the "personal" attributes I need to change.
<name type="personal">\n[ \t]+<displayForm>Trust</displayForm>
should accurately match
Code: Select all
<name type="personal">
<displayForm>Trust</displayForm>
(I'm doing a find replace "personal" with "corporate" where displayForm="trust") but it doesn't work. Any ideas why oxygen's regex is different from the web engine I'm testing on?
It is also possible this could easily be done with xquery, I can identify the attributes but I don't know how to change the value.
//mods:displayForm[text()[contains(.,'Trust')]]/ancestor::mods:name/@type correctly identifies the "personal" attributes I need to change.
Re: Regex not working?
Hi,
Oxygen uses in its Find/Replace tools Java regex which is based on Perl 5 regex.
AFAIK \t is the TAB character, so unless your code is indented strictly with TABs, it won't work.
Why not use \s (generic whitespace) instead of \t?
Regards,
Adrian
PS: Use the "Code" tag from the message post toolbar to preserve spaces.
Oxygen uses in its Find/Replace tools Java regex which is based on Perl 5 regex.
AFAIK \t is the TAB character, so unless your code is indented strictly with TABs, it won't work.
Why not use \s (generic whitespace) instead of \t?
Regards,
Adrian
PS: Use the "Code" tag from the message post toolbar to preserve spaces.
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
Re: Regex not working?
Hi,
Are you using the Find/Replace dialog with an open editor, or the Find/Replace in Files dialog on files from the file system?
Please check your Find options for filters (XPath or XML search options).
I tested and even the initial regexp with \t is working for me (there's a space before \t that I did not notice before) in the Find/Replace dialog with Options: Regular expression enabled. All these work for me there:
I recommend the last one for simplicity.
If you're searching with the Find/Replace in Files dialog avoid using \n as the line terminator in your regexp. In my case, since I'm in Windows the line terminator is \r\n, so it won't work with just \n. It's best to just use \s to avoid platform specific line terminators.
Regards,
Adrian
Are you using the Find/Replace dialog with an open editor, or the Find/Replace in Files dialog on files from the file system?
Please check your Find options for filters (XPath or XML search options).
I tested and even the initial regexp with \t is working for me (there's a space before \t that I did not notice before) in the Find/Replace dialog with Options: Regular expression enabled. All these work for me there:
Code: Select all
<name type="personal">\n[ \t]+<displayForm>Trust</displayForm>
Code: Select all
<name type="personal">\n\s+<displayForm>Trust</displayForm>
Code: Select all
<name type="personal">\s+<displayForm>Trust</displayForm>
If you're searching with the Find/Replace in Files dialog avoid using \n as the line terminator in your regexp. In my case, since I'm in Windows the line terminator is \r\n, so it won't work with just \n. It's best to just use \s to avoid platform specific line terminators.
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)
- ↳ 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