Skip to content

Files

Latest commit

Nov 25, 2024
4b0de73 · Nov 25, 2024

History

History
31 lines (23 loc) · 866 Bytes

README.md

File metadata and controls

31 lines (23 loc) · 866 Bytes

Regexp

Regular expressions in Gleam!

Package Version Hex Docs

gleam add gleam_regexp@1
import gleam/regexp

pub fn main() {
  let assert Ok(re) = regexp.from_string("[0-9]")

  regexp.check(re, "abc123")
  // -> True

  regexp.check(re, "abcxyz")
  // -> False
}

This package uses the regular expression engine of the underlying platform. Regular expressions in Erlang and JavaScript largely share the same syntax, but there are some differences and have different performance characteristics. Be sure to thoroughly test your code on all platforms that you support when using this library.

Further documentation can be found at https://hexdocs.pm/gleam_regexp.