• Stars
    star
    137
  • Rank 256,728 (Top 6 %)
  • Language
    Go
  • License
    MIT License
  • Created almost 10 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Basic string globs in golang

String globbing in golang Build Status

go-glob is a single-function library implementing basic string glob support.

Globs are an extremely user-friendly way of supporting string matching without requiring knowledge of regular expressions or Go's particular regex engine. Most people understand that if you put a * character somewhere in a string, it is treated as a wildcard. Surprisingly, this functionality isn't found in Go's standard library, except for path.Match, which is intended to be used while comparing paths (not arbitrary strings), and contains specialized logic for this use case. A better solution might be a POSIX basic (non-ERE) regular expression engine for Go, which doesn't exist currently.

Example

package main

import "github.com/ryanuber/go-glob"

func main() {
    glob.Glob("*World!", "Hello, World!") // true
    glob.Glob("Hello,*", "Hello, World!") // true
    glob.Glob("*ello,*", "Hello, World!") // true
    glob.Glob("World!", "Hello, World!")  // false
    glob.Glob("/home/*", "/home/ryanuber/.bashrc") // true
}

More Repositories

1

columnize

Easy column formatted output for golang
Go
163
star
2

slide.sh

Create simple, text-based slide decks in your shell
Shell
70
star
3

go-license

Software licensing standardization library for Golang
Roff
69
star
4

pakrat

A Python library and CLI tool for mirroring and versioning YUM repositories
Python
60
star
5

readme-server

Go app to quickly render markdown README's and display them
Go
26
star
6

go-otp

Simple one-time pad crypto library for golang
Go
14
star
7

go-filecache

Cache data in flat files in Golang
Go
7
star
8

shortstr

Go
6
star
9

puppet-packagelist

Dynamically create package resources from lists
Ruby
6
star
10

puppet-tell

Tell external parties about changes to resources
Ruby
6
star
11

go-semver

Semantic versioning (semver.org) for golang
Go
5
star
12

iocap

Go package for rate limiting data streams using the familiar io.Reader and io.Writer interfaces.
Go
3
star
13

projects

Random projects in various languages
PHP
3
star
14

ruby-aptly

Ruby wrapper for managing deb repos with Aptly (http://aptly.info)
Ruby
3
star
15

veneer

An experimental REST API framework for PHP
PHP
3
star
16

nofork

Wrap a long process with a pidfile without forking
Go
2
star
17

terraform-tests

Various test Terraform configurations
HCL
2
star
18

yum-rocket

Fast, distributed, parallel downloads for YUM
Python
2
star
19

strategy-gem

Create runnable, stepped workflow plans in ruby
Ruby
1
star
20

oaf

Care-free web app prototyping using files and scripts
Ruby
1
star
21

dotfiles

Only the important ones
Shell
1
star
22

sertify

Certify string data in multiple languages
Ruby
1
star
23

huck

Open-ended information sharing framework
Ruby
1
star
24

go-permtest

Cross-platform methods for checking if files or directories are writable
Go
1
star
25

go-duration-ruby

Golang duration parser/formatter for Ruby
Ruby
1
star