FINDNEXT Function

Continues to search the string for the next match after using the FINDNEXT() function.

Category: Regular Expression
Returned data type: Boolean

Syntax

r.FINDNEXT(input)

Required Argument

input

specifies the string value in which you want to search for the pattern defined by your compiled regular expression. This can be an explicit string ("MyValue"). This can also be a variable already defined in your expression code or passed to your expression node as a column from a previous node (MyValue or "My Value").

  Requirement input must not be NULL or blank

Details

The FINDNEXT function indicates that another pattern match has been found after FINDFIRST() has been used. Using a "While" statement loop lets you iterate through all potential pattern matches using this function as long as the return value is equal to true.

The function returns TRUE if a pattern match was found. Otherwise, it returns FALSE.

Examples

Note: This example can be run in a stand-alone expression node if the Generate rows when no parent is specified option is selected. If passing data to this node, turn this setting off and remove the SETEOF( ) function. The PUSHROW statements are also unnecessary if passing data values in to the node as data rows. Unless stated otherwise, all code shown should be entered in the Expression tab of the Expression node.

// Define some string variables

string MyString

string MySubString

 

// Set one to some sample input

MyString = "DwAwTxAxFyLyUzXz"

 

//You must define a regex object

regex r

// Then compile your regular expression

// This one will match any single uppercase letter

r.compile("[A-Z]")

// Find the first pattern match

if r.findfirst(MyString)

   begin

   // Pull the pattern from MyString and place it into MySubString

   MySubString = mid(MyString, r.matchstart(),r.matchlength())

   // Use pushrow to create new rows - this is purely for the sake of

   // clarity in the example

   pushrow()

   // Create a while loop that continues to look for matches

   while r.findnext(MyString)

      begin

      // Pull the pattern from MyString and place it into MySubString agin

      MySubString = mid( MyString, r.matchstart(),r.matchlength())

      // Just for display again

      pushrow()

      end

   end

// Terminate the expression node processing

seteof(true)

// Prevent the last pushrow() from showing up twice

return false