Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
Topic Title: Unexpected error on Regular Expression
Topic Summary:
Created On: 11-Sep-2008 08:58
Status: Post and Reply
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 11-Sep-2008 08:58
User is offline View Users Profile Print this message


Paul R Miller

Posts: 29
Joined: 16-Feb-2007

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
Report this to a Moderator Report this to a Moderator
 11-Sep-2008 09:18
User is offline View Users Profile Print this message


Paul Tiplady

Posts: 176
Joined: 28-Oct-2003

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
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 1 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 1 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.