Find Regular Expression

From UBot Studio
Revision as of 16:35, 17 January 2017 by LillyT (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

$Find Regular Expression is a Text Function.

The function returns a list of all matches of the provided regular expression. Find regular expression allows users to conduct specific searches on text strings using regular expressions. This function is used for lists, variables, or whatever piece of scraped information.

Text: The text being searched. Accepts variables and functions such as $next list item, $list item, $random list item, $previous list item, and $table cell.

Regular Expression: The regex for the text being searched for in the original text.

Example 1

set(#numbers, "12423 44456 12824 53624", "Global")
navigate("http://www.ubotstudio.com/playground/simple-form", "Wait")
type text(<username field>, $find regular expression(#numbers, "[1]...[3]"), "Standard")


Running the script returns the number 12423 in the username field because it is the only string that meets the regex criteria.


Hfgd7.jpg


Example 2

This example will only return the value of the variable in the text box if the value matches the criteria specified in the regex.

ui text box("Type First and Last Name Here:", #blue)
set(#testing, $find regular expression(#blue, "^(?<FirstName>\\w+)\\s(?<LastName>\\w+)$"), "Global")

Typing the word "Test" into the text box and running the script returns no value, because the regex is specifically looking for two Proper case words.

Typing the word "Amy Blark" into the text box returns the value "Amy Blark" because that value matches the regex criteria of two Proper case words.


The Do Not Parse Feature

UBot Studio will parse some symbols as math expressions.

For example, t{3} means we are looking for "ttt". {3} will be parsed as a math expression.

When you type that into UBot Studio, the {} around the number 3 will be removed.

To keep UBot Studio from parsing the regex as a math expression, simply click the "" (quotes) button under Pattern Text.


Quotesbutton0.gif

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox