re2r (version 0.2.0)

show_regex: Show regex pattern in a htmlwidget

Description

Show JS-style regex pattern in an htmlwidget.

Usage

show_regex(pattern, width = NULL, height = NULL)

Arguments

pattern

a pattern string

width

the widget width

height

the widget height

Details

Most parts of RE2 regex syntax are supported, except for some special Unicode character classes.

See Also

https://regexper.com/documentation.html

Examples

Run this code
# NOT RUN {
# Skip on CRAN

# }
# NOT RUN {
# US ZIP code

show_regex("[0-9]{5}(?:-[0-9]{4})?")

# Email

show_regex("\\b[a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}\\b")

# Hex value

show_regex("#?([a-f0-9]{6}|[a-f0-9]{3})")

# }
# NOT RUN {
# }

Run the code above in your browser using DataCamp Workspace