Skip to content

hreese/goodregex

Repository files navigation

CI

A collection of regular expressions for Go. This is the core of resolveip.

The name does not make any claims about the quality of the regular expressions included. The author just needed a short intuitive name :-)

Feedback, tests and comments are always welcome.

Installation

go get github.com/hreese/goodregex

Usage

Go Reference

This package currently exports three regular expressions:

  • MatchIPv4 (matches IPv4 addresses)
  • MatchIPv6 (matches IPv6 addresses)
  • MatchHostname (matches hostnames)

Experimental bounded versions (MatchBoundedIPv4, MatchBoundedHostname) are also available. These only match when the pattern is surrounded by word boundaries, preventing partial matches inside longer strings.

Use them like normal regular expressions from regexp.

This package also exports CompileReadableRegex and MustCompileReadableRegex, which compile "readable regexes" -- RE2 expressions with embedded whitespace and #-style comments stripped before compilation.

About

A collection of regular expressions for Go

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages