Skip to content

Regex Match

The regex::match function checks whether a string matches a specified regular expression pattern.

Syntax

regex::match(<pattern>, <string>)

Parameters

  • pattern: The regular expression pattern to match against.
  • string: The input string to test.

Returns

  • Boolean: true if the string matches the pattern, otherwise false.

Example

Try it out below!
regex::match("^[a-zA-Z]+$", "hello")

This function is useful for validating strings against patterns, such as ensuring they follow a certain format.