Type in a command, or "ls dictionary" to search all commands for "dictionary", etc.
|
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