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: Parsing Link Attribute values with regular expressions
Topic Summary: grabbing a line from a link attribute and detecting if it's invalid, including blank lines
Created On: 13-Jun-2008 22:19
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.
 13-Jun-2008 22:19
User is offline View Users Profile Print this message


jason haury

Posts: 39
Joined: 20-Feb-2007

As part of a "Batch Link By Attribute" tool I'm trying to improve, I'd like to parse through Link Attributes (an attribute of Type "Text" that contains values compatible with DOORS native "Link by Attribute" tool) and create/delete links accordingly. I'd like the parsing of a Link Attribute (LA) to be more robust than DOORS' tool, which means I want to detect invalid entries (extra newline characters, spaces, non-numeric characters, etc), alert the user, but still process as much as is reasonable. I was originally grabbing lines with a look (see top part of attached code). However, I found that regular expressions, when used to grab lines of text will return true so long as it finds a matching line somewhere, even if it has to skip over several empty lines. This problem was partially solved by making sure that the start of the match was the first character of the string (line 17). However, I can't find a way to detect the final extra newline that comes after the "3" in my example of a LA value. To gain more accurate detection, I had to write the attached function "getLine". With this function, you pass it a string, and tell it where to start looking. It then grabs all the text up to the next newline or the end of the string. The index of this endpoint is returned via an argument passed by reference, "endex".

Can anyone think of how to accomplish this same task with regexps? I'm sure the regexp implementation i have in the top half of the code could be made more efficient with a Buffer and using the find() function. but either way, the problem of a regexp not finding an empty line is problematic.

Jason
Report this to a Moderator Report this to a Moderator
 18-Jul-2008 14:36
User is offline View Users Profile Print this message


Paul Howstan

Posts: 47
Joined: 27-Sep-2006

Hi Jason,

I'm not entirely sure what you're trying to do, but attached are two methods to itterate through this string ignoring white space (space newline or tab)

Hope it helps,

Paul Howstan
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.