Learn R Programming

smvr (version 0.2.2)

SEM_VER_PATTERN: A suggested regular expression (RegEx) to check a SemVer string

Description

This is a suggested regular expression (RegEx) to check a SemVer string, without the "^" at the start and "$" at the end. It is useful to extract the SemVer components from VCS tags etc.

Usage

SEM_VER_PATTERN

Arguments

Value

Single string

Format

An object of class character of length 1.

Examples

Run this code
SEM_VER_PATTERN

# VCS tag names often have a "v" prefix to SemVer
tag_names <- c("v1.0.0", "v1.1.0-alpha.1", "v1.1.0+build.1", "not-a-version")

# Extract and parse SemVer
regmatches(tag_names, m = regexpr(SEM_VER_PATTERN, tag_names)) |>
  parse_semver()

Run the code above in your browser using DataLab