Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mingrammer/commonregex
🍫 A collection of common regular expressions for Go
https://github.com/mingrammer/commonregex
commonregex pattern regex regexp regular-expression validation
Last synced: 10 days ago
JSON representation
🍫 A collection of common regular expressions for Go
- Host: GitHub
- URL: https://github.com/mingrammer/commonregex
- Owner: mingrammer
- License: mit
- Created: 2017-03-23T14:33:18.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-11-12T07:22:40.000Z (almost 5 years ago)
- Last Synced: 2024-07-31T20:53:11.448Z (3 months ago)
- Topics: commonregex, pattern, regex, regexp, regular-expression, validation
- Language: Go
- Homepage:
- Size: 41 KB
- Stars: 887
- Watchers: 23
- Forks: 67
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-go - commonregex - A collection of common regular expressions for Go. (Text Processing / Parsers/Encoders/Decoders)
- awesome-go - commonregex - A collection of common regular expressions for Go - ★ 506 (Text Processing)
- awesome-go-extra - commonregex - 03-23T14:33:18Z|2019-11-12T07:22:40Z| (Bot Building / Parsers/Encoders/Decoders)
- awesome-discoveries - commonregex - a collection of common regular expressions for Go _(`Go`)_ (Libraries)
- awesome - commonregex - 🍫 A collection of common regular expressions for Go (Go)
README
CommonRegex
A collection of often used regular expressions for Go
> Inspired by [CommonRegex](https://github.com/madisonmay/CommonRegex)
This is a collection of often used regular expressions. It provides these as simple functions for getting the matched strings corresponding to specific patterns.
## Installation
```shell
go get github.com/mingrammer/commonregex
```## Usage
```go
import (
cregex "github.com/mingrammer/commonregex"
)func main() {
text := `John, please get that article on www.linkedin.com to me by 5:00PM on Jan 9th 2012. 4:00 would be ideal, actually. If you have any questions, You can reach me at (519)-236-2723x341 or get in touch with my associate at [email protected]`dateList := cregex.Date(text)
// ['Jan 9th 2012']
timeList := cregex.Time(text)
// ['5:00PM', '4:00']
linkList := cregex.Links(text)
// ['www.linkedin.com', '[email protected]']
phoneList := cregex.PhonesWithExts(text)
// ['(519)-236-2723x341']
emailList := cregex.Emails(text)
// ['[email protected]']
}
```## Features
* Date
* Time
* Phone
* Phones with exts
* Link
* IPv4
* IPv6
* IP
* Ports without well-known (not known ports)
* Price
* Hex color
* Credit card
* VISA credit card
* MC credit card
* ISBN 10/13
* BTC address
* Street address
* Zip code
* Po box
* SSN
* MD5
* SHA1
* SHA256
* GUID
* MAC address
* IBAN
* Git Repository## Thanks to :heart:
* [@cschoede](https://github.com/cschoede)
* [@schigh](https://github.com/schigh)
* [@emaraschio](https://github.com/emaraschio)
* [@mamal72](https://github.com/mamal72)
* [@ahmdrz](https://github.com/ahmdrz)
* [@fakenine](https://github.com/fakenine)
* [@Bill-Park](https://github.com/Bill-Park)
* [@jakewarren](https://github.com/jakewarren)## License
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fmingrammer%2Fcommonregex.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fmingrammer%2Fcommonregex?ref=badge_large)