All Projects → ResultadosDigitais → espressione

ResultadosDigitais / espressione

Licence: other
Espressione is a Ruby community-driven common regular expression patterns gem

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to espressione

stringx
Drop-in replacements for base R string functions powered by stringi
Stars: ✭ 14 (+7.69%)
Mutual labels:  regexp
jquery-datatables
Jquery datatables ruby gems for assets pipeline
Stars: ✭ 73 (+461.54%)
Mutual labels:  rubygem
benchmark-malloc
Trace memory allocations and collect stats
Stars: ✭ 18 (+38.46%)
Mutual labels:  rubygem
circleci
CircleCI REST API Ruby Gem
Stars: ✭ 93 (+615.38%)
Mutual labels:  rubygem
micell
A collection of functions for front-end development
Stars: ✭ 16 (+23.08%)
Mutual labels:  regexp
gettext i18n rails js
Extends gettext_i18n_rails making your .PO files available to client side javascript as JSON
Stars: ✭ 28 (+115.38%)
Mutual labels:  rubygem
RegExp-Learning
学习正则表达式
Stars: ✭ 30 (+130.77%)
Mutual labels:  regexp
shortuuid.rb
Convert UUIDs & numbers into space efficient and URL-safe Base62 strings, or any other alphabet.
Stars: ✭ 38 (+192.31%)
Mutual labels:  rubygem
String.prototype.matchAll
Spec-compliant polyfill for String.prototype.matchAll, in ES2020
Stars: ✭ 14 (+7.69%)
Mutual labels:  regexp
rexreplace
Smooth find & replace CLI as it should be: simple file selection with globs, flexible patterns with regex and dynamic replacements from js code.
Stars: ✭ 19 (+46.15%)
Mutual labels:  regexp
retrie
Efficient Trie-based regex unions for blacklist/whitelist filtering and one-pass mapping-based string replacing
Stars: ✭ 35 (+169.23%)
Mutual labels:  regexp
git-status-all
Get the status of all git repositories in a directory
Stars: ✭ 32 (+146.15%)
Mutual labels:  rubygem
workbook
simple framework for containing spreadsheet like data
Stars: ✭ 13 (+0%)
Mutual labels:  rubygem
capistrano-docker-compose
Docker Compose specific tasks for Capistrano
Stars: ✭ 17 (+30.77%)
Mutual labels:  rubygem
subst
Search and des... argh... replace in many files at once. Use regexp and power of Python to replace what you want.
Stars: ✭ 20 (+53.85%)
Mutual labels:  regexp
npmdc
ruby gem to check for missed NPM dependencies
Stars: ✭ 38 (+192.31%)
Mutual labels:  rubygem
ElementFinder
Fetch data from HTML and XML via xpath/css and prepare it with regexp
Stars: ✭ 29 (+123.08%)
Mutual labels:  regexp
eslint-plugin-clean-regex
An ESLint plugin for writing better regular expressions.
Stars: ✭ 280 (+2053.85%)
Mutual labels:  regexp
nlp-pure
Natural language processing algorithms implemented in pure Ruby with minimal dependencies
Stars: ✭ 19 (+46.15%)
Mutual labels:  rubygem
mention-hashtag
Extract mentions (@mention) or hashtags (#hashtag) from any text
Stars: ✭ 16 (+23.08%)
Mutual labels:  regexp

Espressione

Gem Version Build Status Maintainability Test Coverage

Espressione is a ruby gem to provide useful regex patterns.

Installation

Add this line to your application's Gemfile:

gem 'espressione'

And then execute:

$ bundle

Or install it yourself as:

$ gem install espressione

Usage

You can import your set of expressions directly from the YAML file.

# In phone.yml
local: '\(?[0-9]{2,3}\)? ?[0-9]{3,4}[ -]?[0-9]{4}'
international: '\+[0-9]{2}? \(?[0-9]{2,3}\)? ?[0-9]{3,4}[ -]?[0-9]{4}'
require "espressione"

Espressione.load "phone.yml", prefix: :phone

Espressione.phone_local # => /\(?[0-9]{2,3}\)? ?[0-9]{3,4}[ -]?[0-9]{4}/
Espressione.phone_international # => /\+[0-9]{2}? \(?[0-9]{2,3}\)? ?[0-9]{3,4}[ -]?[0-9]{4}/

Or you can use our standard set of expressions:

datetime, date, time, uuid, ip, ipv6, url, email, subdomain, html_tag

# validate simple email
email = '[email protected]'
puts "Contains a valid e-mail" if Espressione.email.match(email)

# validate url
url = "https://github.com/dvinciguerra"
puts "Contains a valid url" if  Espressione.url.match(url)

# validate a uuid
uuid = '8539ad20-317e-0137-4c89-7aa46e47cfb4'
puts "Contains a valid uuid" if Espressione.uuid.match(uuid)

# validate a datetime
datetime = Time.now.utc
puts "Contains a valid datetime" if Espressione.datetime.match(datetime.to_s)

# validate a ip
ip = '192.168.1.1'
puts "Contains a valid ip" if Espressione.ip.match(ip)

datetime

  Espressione.datetime.match("2019-04-30 18:37:07 UTC")

date

  Espressione.date.match("2019-04-30")

time

  Espressione.time.match("10:01:12")

uuid

  Espressione.uuid.match("8539ad20-317e-0137-4c89-7aa46e47cfb4")

ip

  Espressione.ip.match("127.0.0.1")

ipv6

  Espressione.ipv6.match("2001:0db8:85a3:0000:0000:8a2e:0370:7334")

url

  Espressione.url.match("https://github.com/dvinciguerra")

email

  Espressione.email.match("[email protected]")

subdomain

  Espressione.subdomain.match("shipit.resultadosdigitais.com.br")

html_tag

  Espressione.html_tag.match("<body>")

Development

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/dvinciguerra/espressione.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].