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: RegExp - using the | operator.
Topic Summary: Search for words e.g "speaker" or "Speaker"
Created On: 29-May-2007 19:32
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 Martin Hunter, on Thursday, June 7, 2007 12:05 AM

Answer:
Krishna,

A few months ago I posted my Global Search Utility which should do what your looking to achieve. See the following thread.

https://support.telelogic.com/en/doors/forums/messageview.cfm?catid=17&threadid=4382

"Speaker" and "speaker" can both be searched for by turning match case off.

- Martin
 29-May-2007 19:32
User is offline View Users Profile Print this message


Krishna Kandala

Posts: 170
Joined: 8-Jul-2006

I am working on a script to search for a word in the object text in all the modules of a folder using Regular Expressions. A string variable reads the text entered in a DB  and assigns the value to a RegExp.
RegExp stringToSearch = regexp(string textEnteredDBE)
This works fine. But I want to add another feature to the expression - if the text entered is "speaker", I want to search for "speaker" or "Speaker" - the first character of the word in upper case.
I have a string function that converts the string to another string with the first character in upper case. The new string is firstCharacterUpper(textEnteredDBE).
When I modify the the regular expression with the code

RegExp stringToSearch = regexp(textEnteredDBE|firstCharacterUpper(textEnteredDBE)), I get an error. What is going wrong?

Report this to a Moderator Report this to a Moderator
 29-May-2007 22:05
User is offline View Users Profile Print this message


ron lewis

Posts: 650
Joined: 20-Sep-2004

For starters try changing RegExp to Regexp and add quotes around |

ie.,

Regexp stringToSearch = regexp(textEnteredDBE "|" firstCharacterUpper(textEnteredDBE))

This will get it to compile but to get your desired results you will need quotes around

each outer parenthesis ie.,

Regexp stringToSearch = regexp "(" textEnteredDBE "|" firstCharacterUpper(textEnteredDBE) ")"

A nit -- stringToSearch is not a very good variable name since it isn't a string -- it is a regular expression pattern.

Also, textEnteredDBE had better be a string not a 'Dialog Box Element' which the suffix implies.

Edited: 30-May-2007 at 11:52 by ron lewis
Report this to a Moderator Report this to a Moderator
 30-May-2007 17:10
User is offline View Users Profile Print this message


Krishna Kandala

Posts: 170
Joined: 8-Jul-2006

Thanks, Ron, for the suggestion and pointing out the typos in my post. This is a real help as I can search for two words (with the first character in upper case) instead of one.

Report this to a Moderator Report this to a Moderator
 6-Jun-2007 14:16
User is offline View Users Profile Print this message


Martin Hunter

Posts: 86
Joined: 10-Jan-2005

Answer Answer
Krishna,

A few months ago I posted my Global Search Utility which should do what your looking to achieve. See the following thread.

https://support.telelogic.com/en/doors/forums/messageview.cfm?catid=17&threadid=4382

"Speaker" and "speaker" can both be searched for by turning match case off.

- Martin

-------------------------
- Martin
Report this to a Moderator Report this to a Moderator
 7-Jun-2007 00:04
User is offline View Users Profile Print this message


Krishna Kandala

Posts: 170
Joined: 8-Jul-2006

Hi Martin,

I posted my reply in the thread you pointed out. This is a very useful script, which will save all of us considerable amount of time.
Thanks again

- Krishna
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.