Q. What's with the /i in Ruby regular expressions?
A. the /i indicates an ignore case modifier ...
In Ruby, a regular expression is written in the form of /pattern/modifiers where "pattern" is the regular expression itself, and "modifiers" are a series of characters indicating various options.
Ruby supports the following modifiers:
* /i makes the regex match case insensitive.
* /m makes the dot match newlines. Ruby indeed uses /m, whereas Perl and
many other programming languages use /s for "dot matches newlines".
* /x tells Ruby to ignore whitespace between regex tokens.
* /o causes any #{...} substitutions in a particular regex literal to be performed just once, the first time it is evaluated. Otherwise, the substitutions will be performed every time the literal generates a Regexp object.
You can combine multiple modifiers by stringing them together as in /regex/is.
See more information here: http://www.regular-expressions.info/ruby.html
Q. How do I get text from a browser?
A. Use a regex match on the .text method ...
Example html:
<p> The Employee Code assigned is 10000671 </p>
Example watir:
puts /(1\d+)/.match(@b.text)