Skip to content
sebscholl-labsPublic

About

Named, tested regular expressions for Ruby

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

18 Commits

Folders and files

Repository files navigation

regexes

Gem Version CI Release License Ruby

The regex you need, already written. Patterns named for what they match — UUIDs, IP addresses, ISO 8601 times, IBANs — each a frozen Regexp that chains anchors, repetition and captures, tested against Ruby's own parsers, and runs the same in JavaScript. No dependencies.

log = 'Retry 10.0.0.1, not 1.2.3.456'

log.scan(/\d{1,3}(?:\.\d{1,3}){3}/)   # => ["10.0.0.1", "1.2.3.456"]
log.scan(Regexes.ipv4_address)         # => ["10.0.0.1"]

"ok\nevil".match?(/^[a-z]+$/)                                  # => true: ^ and $ are line anchors in Ruby
Regexes.lowercase_letters.one_or_more.whole.match?("ok\nevil")  # => false

Regexes.semantic_version.match('2.1.3-rc.1+sha.5114f85')[:prerelease]  # => "rc.1"

Documentation: https://sebscholl-labs.github.io/regexes/ · Install and use: gem/README.md

Repository layout

Directory Purpose README
gem/ The published gem source: lib/, test/, gemspec, CHANGELOG.md. Everything that ends up on RubyGems lives here. gem/README.md
site/ The VitePress documentation site published to https://sebscholl-labs.github.io/regexes/. site/

Working in this repo

Each package is independent and uses its own dependencies.

# work on the gem
cd gem
bundle install
bundle exec rake          # full test + lint suite

# work on the docs site
cd site
npm install
npm run dev               # local VitePress server

CI

Three GitHub workflows live in .github/workflows/:

Workflow Triggers What it does
ci.yml push to main, every PR Runs the gem's Minitest suite on Ruby 4.0, the RuboCop quality job, and builds the docs site
release.yml a published GitHub Release Re-runs the gem suite on the tagged commit, then publishes the gem to RubyGems.org via OIDC trusted publishing
docs.yml push to main Builds the VitePress site from site/ and deploys it to GitHub Pages

Contributing

  • Bug or feature in the gem → PR against gem/. Tests live in gem/test/ (Minitest). bundle exec rake runs them plus RuboCop.
  • Documentation site → PR against site/. The build is npm run build.

License

MIT.

About

Named, tested regular expressions for Ruby

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages