
The String Regex Module is similar to the Regex Module in Yahoo Pipes. The String Regex Module works on a single input string, as opposed to the Regex Module that works on each item in a feed.
This module can be useful if we want to write a regular expression to convert a text string such as “Ticketmaster” into a valid URL – So we could make a user input query of “Ticketmaster” become “http://ticketmaster.com”.
See regex module for regular expressions definition.
Again, regular expressions are very powerful and go beyond the scope of this guide, but we are going to work on a quick example of how to use the String Regex Module to turn a user inputted text string “ticketmaster” into a valid URL: http://ticketmaster.com
First we can enter the string “ticketmaster” into the Text Input Module and wire it into the String Regex Module…

Now we need to use some regex magic.
In the “replace” field of the String Regex module, we are going to type “(.+)”. And the “.” Is going to match any character. The “+” will match one or more of the preceding character. The parenthesis will store the string as a numbered variable (variables are stored as $1, $2, $3 and so on). Combined, they mean that one or more of any character will be matched (i.e. the entire string will be matched).
In the “with” field of the String Regex module, we’re going to type http://$1.com. The http:// and “.com” are exactly what they say. The “$1” refers to our string “ticketmaster”.
Lets see what the results are in the Debugger pane:

Now we have a valid URL that can be passed along to other modules such as the URL Builder for further processing.

Recent Comments