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: Regular Expression
Topic Summary:
Created On: 17-Apr-2007 12:36
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.
 17-Apr-2007 12:36
User is offline View Users Profile Print this message


Karl Breuer

Posts: 66
Joined: 11-Jul-2005

Hi all,

I do not have much experience with regular expressions but I thought they might help solve my problem.

What I want to do:
I have a string which contains usernames or email addresses separated by blanks.
I would like to put those into a skip list to use the sendEmailMessage function.

The following regular expression correctly returns the first match in the string

Regexp regulex = regexp "[a-zA-Z|0-9|.][^ ]*"
string txt = "username firstname.lastname@yahoo.com ..."
if (regulex txt) {
     print txt[match 0]
}

Now the question is, how can I get the second match and the third, and so on?

Maybe I am doing it all wrong.
or maybe regular expression is not the best way to do it at all...

Any help or suggestion will be much appreciated.
Thank you

Karl

Report this to a Moderator Report this to a Moderator
 17-Apr-2007 12:42
User is offline View Users Profile Print this message


Paul Tiplady

Posts: 176
Joined: 28-Oct-2003

The simplest solution that I know of is to lop the front off the string after you've processed it. So you need to swap the 'if' for a 'while', and add something like 'txt = txt[end 0:]' at the end of the while loop.

See code snippet (modified).

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


Paul dot Tiplady at TRW dot com
TRW Automotive
Report this to a Moderator Report this to a Moderator
 17-Apr-2007 13:38
User is offline View Users Profile Print this message


Reik Schroeder

Posts: 361
Joined: 28-Jul-2003

Hi Karl,

your regular expression is not much suited for finding the explained strings.
It would be much better do this in following way:

Greetings
Reik

-------------------------
Evosoft GmbH
for Siemens Industry Sector


Berlin, Germany
Report this to a Moderator Report this to a Moderator
 17-Apr-2007 13:53
User is offline View Users Profile Print this message


Karl Breuer

Posts: 66
Joined: 11-Jul-2005

Hi Reik,

your code works just great!
Thanks a lot.

Paul, your code as it is creates an endless loop.
But thank you anyway.

cheers
Karl
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 2 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 2 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.