Tinderbox v9 Icon

String.following(matchStr)


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator Last Altered: 

 Function  [other Function type actions]

 Item  [operators of similar scope]

 Data manipulation  [other Data manipulation operators]

 Baseline

 As at baseline


String.following(matchStr)

The .following( ) operator extracts information from one or more paragraphs of a string using a literal quoted string as the match (i.e. no regex support). If matchStr appears in a line, then whatever follows after the matchStr is the result. If matchStr appears in more than one line, the return value is a list of results.

For example, if the text of a note is:

	From: Mark
	To: Clotilde
	Subject: Mignardise

Then:

$MyString = $Text.following("To:"); 

would return "Clotilde".

$MyString = $Text.following(":"); 

would return "Mark;Clotilde:Mignardise".

In addition, the .following() operator binds any text that precedes the matchStr string to $0. If the matchStr appears several times, the first prefix is bound to $0, the second to $1, and so forth.

The .following() operator's argument is interpreted as a sequence of characters, not a regular expression. If the flexibility of regular expressions is needed, use .find() instead.

The .following() operator is useful for extracting formal and semi-formal data from free text and simple interchange formats like email and RIS.