Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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: 4 days ago
JSON representation

🍫 A collection of common regular expressions for Go

Awesome Lists containing this project

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
* Email
* 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)