Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

selection based on regular-expression?

Status
Not open for further replies.

kschut

Technical User
Jun 11, 2002
24
US
Hi all,

How can I make a record-selection, based on a part of a data-field? Suppose that I have 5 records in which this data-field contains the following strings:

"top-level/sub-level/third-level"
"another_level/level2/dummy1"
"yet-another_level/level3/dummy-level"
"again-another_level/level2/dummy2"
"level1/level2/level3/level4/level5"

and I want to list the number of records which have the same string between the first 2 "/" characters?

So: for the above I would like to get:

sub-level 1
level2 3
level3 1

This seems like fairly basic regex-filtering. I know how to do this is shell-scripting, c, perl. I do not know how to do this in Impromptu.

KS.
 
Extract between first 2 "/" :
substring(Field_Name ; instr( Field_Name ;"/";1)+1;instr( Field_Name ;"/";2)-2 )

Subtring extract a string between 2 positions.
Instr search for a string in Field_name , you can specify which occurence ( first ,second , third one ...) and return the position in the Field_Name.

Then you can count them.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top