Type in a command, or "ls dictionary" to search all commands for "dictionary", etc.

ifMatch

(This command has been awarded a Yubnub Golden Egg)

http://jonathanaquino.com/yubscripts/ifthen/regexp.php?pattern=${pattern}&string=${string}&then=${then}&els=${else}&redirect=${redirect=false}&xn_auth=no
NAME
     ifMatch - Searches a string for a match to a regular expression pattern and returns a value based on the result.

SYNOPSIS
     ifMatch -pattern [REGEX PATTERN] -string [STRING] -then [RESULT IF MATCH] -else [RESULT IF NOT MATCH] -redirect [REDIRECT]

EXAMPLES
     ifMatch -pattern /wor/ -string Hello world! -then yub -else nub
         (Returns "yub")
     
     ifMatch -pattern /Wor/i -string Hello world! -then yub -else nub
         (Returns "yub". The "i" indicates that the pattern is case insensitive)
     
     ifMatch -pattern /^wor/ -string Hello world! -then yub -else nub
         (Returns "nub". The string does not begin with "wor")

DESCRIPTION
     Checks if a string matches a regular expression (regex) pattern and returns a value depending
     on the result of the comparison.
     
     -pattern, -string, and -then are required parameters.
     
     The '-redirect' parameter can be set to True or False. It defaults to False. If set to True
     and the result of the command begins with "HTTP://" then the the command will attempt to
     redirect the user to the web site.

NOTES
     Hint: Most regular expressions are surrounded by forward slashes (/).
     
     Need help composing regex patterns?
     http://weblogtoolscollection.com/regex/regex.php
     http://regexlib.com/cheatsheet.aspx

AUTHOR
     Allen Ormond - aormond (at) gmail (dot) com
    
3074 uses - Created 2006-04-03 18:18:56 - Last used 2013-03-27 16:37:55
Is this command broken? Tell Jon if you know how to fix it.