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 through a string in a module
Topic Summary: Capturing a specific substring
Created On: 3-Aug-2005 16:56
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.
Answer This question was answered by Paul Worrall, on Thursday, August 4, 2005 4:54 PM

Answer:
I'm not able to test this right now but I think what you want is:
string findMe = "Table 3\\b"

\b matches the beginning or end of a word where a word is [a-zA-Z0-9]+

Edit: I've checked this now - you need a double backslash before the b
 3-Aug-2005 16:56
User is offline View Users Profile Print this message


Brian Jackson

Posts: 10
Joined: 2-Aug-2005

I'm looking for a way to find a specific substring contained in a string that's in a module. For example, I have the following substring and string information:
String: "To find the correct configuration settings, use Table 3 as reference.
Substring: "Table 3"

I already have a DXL script that's capable of finding the example substring. Below, is an example of that rough DXL script:

----------------------------------------------------------
Object o
string attrName = "Object Text" // This is the attribute to search
string findMe = "Table 3"          // This is the substring I'm looking for

Regexp line = regexp findMe    // Find all occurances of the substring specified in findMe
int strLen  = length findMe       // The length of the string
string s

for o in current Module do
{
  s = o.attrName ""
  if (line s)
  {
     print "Found Table 3 reference\n"
  }
}

----------------------------------------------------------

The problem comes about when I try to find the same example substring in a example string as follows:
String: "Most of the onboard settings are found in Table 304."

With the above DXL script, it will acknowledge Table 304. That's not what I want to do. Do you have any suggestions as to how I could modify my script in such a way that it will NOT acknowledge the above string? I hope I'm making sense.

Report this to a Moderator Report this to a Moderator
 3-Aug-2005 18:15
User is offline View Users Profile Print this message


ron lewis

Posts: 650
Joined: 20-Sep-2004

Change
    if (line s)
to
    if ( ! line s)

Report this to a Moderator Report this to a Moderator
 3-Aug-2005 22:43
User is offline View Users Profile Print this message


Paul Worrall

Posts: 87
Joined: 30-Sep-2003

Answer Answer
I'm not able to test this right now but I think what you want is:
string findMe = "Table 3\\b"

\b matches the beginning or end of a word where a word is [a-zA-Z0-9]+

Edit: I've checked this now - you need a double backslash before the b

Edited: 4-Aug-2005 at 08:56 by Paul Worrall
Report this to a Moderator Report this to a Moderator
 4-Aug-2005 08:36
User is offline View Users Profile Print this message


Tony Goodman

Posts: 1098
Joined: 12-Sep-2002

You could use the keyword function. This only finds words that are preceeded and followed by non-alphanumeric characters. It only works with buffers.

-------------------------
Tony Goodman
http://www.smartdxl.com
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.