Regex replacement crash
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 125
- Joined: Mon Jun 09, 2003 6:02 pm
- Location: Charlottesville, Virginia USA
Regex replacement crash
oXygen 9.1, standalone under Mac OS X
If I try the following regular expression find-and-replace:
Text to find: x*$
Replace with: [empty]
oXygen hangs and has to be killed externally. 'x' above can be any character.
If I try the following regular expression find-and-replace:
Text to find: x*$
Replace with: [empty]
oXygen hangs and has to be killed externally. 'x' above can be any character.
-
- Posts: 9438
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Regex replacement crash
Hello,
Thank you for reporting this issue.
The problem with the expression 'x*$' is that it can also match empty strings located at the end of line because of the x*(0-n occurrences of x). When using 'Replace all' there will always be a match of length 0 at the end of any line so the replace will get stuck in an infinite loop.
If x+(1-n occurrences of x) would have been used then this problem would not have occurred.
We have added an issue to our bug tracking tool and a detection/prevention of such situations will be implemented in the next minor version.
Meanwhile, the workaround is to avoid expressions that match empty strings combined with position markers like '^'(start of line) and '$'(end of line). In your case 'x+$' should solve the problem.
Regards,
Radu
Thank you for reporting this issue.
The problem with the expression 'x*$' is that it can also match empty strings located at the end of line because of the x*(0-n occurrences of x). When using 'Replace all' there will always be a match of length 0 at the end of any line so the replace will get stuck in an infinite loop.
If x+(1-n occurrences of x) would have been used then this problem would not have occurred.
We have added an issue to our bug tracking tool and a detection/prevention of such situations will be implemented in the next minor version.
Meanwhile, the workaround is to avoid expressions that match empty strings combined with position markers like '^'(start of line) and '$'(end of line). In your case 'x+$' should solve the problem.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 125
- Joined: Mon Jun 09, 2003 6:02 pm
- Location: Charlottesville, Virginia USA
Re: Regex replacement crash
Right--I should have mentioned that the expression that I first used when the hang occurred was " *$" where I accidentally typed a single space instead of two spaces. This is an easy mistake to make. Thanks for logging the bug.The problem with the expression 'x*$' is that it can also match empty strings located at the end of line because of the x*(0-n occurrences of x). When using 'Replace all' there will always be a match of length 0 at the end of any line so the replace will get stuck in an infinite loop.
If x+(1-n occurrences of x) would have been used then this problem would not have occurred.
We have added an issue to our bug tracking tool and a detection/prevention of such situations will be implemented in the next minor version.
Meanwhile, the workaround is to avoid expressions that match empty strings combined with position markers like '^'(start of line) and '$'(end of line). In your case 'x+$' should solve the problem.
David
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: Regex replacement crash
Hello,
We have implemented a fix for preventing such situations. The fix will be available in the next minor version(9.3).
Regards,
Adrian
We have implemented a fix for preventing such situations. The fix will be available in the next minor version(9.3).
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