explain(pattern, open = FALSE, print = TRUE, dictionary = getOption("regex.library"))
"@" that is a regular
expression from a qdapRegex dictionary.TRUE the default browser will attempt to
open http://www.regexper.com page. Setting open = 2 will
utilize an unstable visualization via https://www.debuggex.com. This
approach utilizes a non-api scrape that is subject to change and not
guaranteed to be stable. The regex is set to Python flavor which handles
lookbehinds that the Java based http://www.regexper.com does not. This
functionality was developed by
Matthew Flickinger (see
http://stackoverflow.com/a/27574103/1000343 for details). Note that
the user must have httr installed or will be prompted if the package
cannot be required.explain print output to the console?Visualize regular expressions using http://www.regexper.com & http://rick.measham.id.au/paste/explain.
Note that http://www.regexper.com is a Java based regular expression viewer. Lookbehind and negative lookbehinds are not respected.
http://stackoverflow.com/a/27489977/1000343 http://www.regexper.com http://rick.measham.id.au/paste/explain http://stackoverflow.com/a/27574103/1000343
explain("\\s*foo[A-Z]\\d{2,3}")NODE EXPLANATION -------------------------------------------------------------------------------- \\s* whitespace (\n, \r, \t, \f, and " ") (0 or more times (matching the most amount possible)) -------------------------------------------------------------------------------- foo 'foo' -------------------------------------------------------------------------------- [A-Z] any character of: 'A' to 'Z' -------------------------------------------------------------------------------- \\d{2,3} digits (0-9) (between 2 and 3 times (matching the most amount possible))explain("@rm_time")NODE EXPLANATION -------------------------------------------------------------------------------- \\d{0,2} digits (0-9) (between 0 and 2 times (matching the most amount possible)) -------------------------------------------------------------------------------- : ':' -------------------------------------------------------------------------------- \\d{2} digits (0-9) (2 times) -------------------------------------------------------------------------------- (?: group, but do not capture (optional (matching the most amount possible)): -------------------------------------------------------------------------------- [:.] any character of: ':', '.' -------------------------------------------------------------------------------- \\d+ digits (0-9) (1 or more times (matching the most amount possible)) -------------------------------------------------------------------------------- )? end of grouping## <strong>Not run</strong>: # explain("\\s*foo[A-Z]\\d{2,3}", open = TRUE) # explain("@rm_time", open = TRUE) # ## <strong>End(Not run)</strong>