Learn R Programming

swirl (version 2.2.6)

val_matches: Returns TRUE if as.character(e$val) matches the regular expression given as the first argument.

Description

Returns TRUE if as.character(e$val) matches the regular expression given as the first argument.

Usage

val_matches(regular_expression)

Arguments

regular_expression
a regular expression which user value should match

Value

  • TRUE or FALSE

Examples

Run this code
# Test that a user has entered a value matching
  # '[Cc]ollege [Ss]tudents' or has selected it
  # in a multiple choice question.
  #
  val_matches('[Cc]ollege [Ss]tudents')

Run the code above in your browser using DataLab