![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Unexpected error on Regular Expression Topic Summary: Created On: 11-Sep-2008 08:58 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
Using DOORS version 9.0
Why does DOORS raise an error on the following line of code? What law have I transgressed here? Regexp findBackSlash = regexp "[\\]" DOORS raises the error "-R-E- DXL: <Line:1> incorrect regular expression (Regular expression ends prematurely)" ------------------------- Paul Miller Specification Practices Specialist EuroCyber Melbourne, Australia Mobile: + 61 (0) 418 135 103 http://www.eurocyber.biz |
|
![]() |
|
![]() |
|
It's because you have two things there, a string and a regular expression. The string is processed first, and the first "\" escapes the second one. Then the regular expression is run for the resulting string, which is just "[\]". So the single remaining "\" escapes the "]" and you're left with "[]", which the regular expression treats as an opening square bracket with a (literal) closing square bracket, but no square bracket to close the expression.
Solution is to double escape the backslashes, so "[\\\\]" should work... <edit> Note that regular expression parsing changed between 7.x and 8.x, which is why a pile of my scripts don't work any more... </edit> ------------------------- Paul dot Tiplady at TRW dot com TRW Automotive Edited: 11-Sep-2008 at 09:19 by Paul Tiplady |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
Unexpected error on Regular Expression
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.