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

https://github.com/lpsinger/bash_pattern

Bash-inspired pattern matching in C.
https://github.com/lpsinger/bash_pattern

Last synced: 9 months ago
JSON representation

Bash-inspired pattern matching in C.

Awesome Lists containing this project

README

          

C library for approximately bash-compatible pattern matching.

Supports the following features:

- The '*' wildcard, which matches any sequence of zero or more characters.
- The '?' wildcard, which matches exactly one character.
- Brace syntax for alternatives, such that {foo,bar,bat} matches any of
foo, bar, or bat. Braces can also contain other braces and wildcards.
- Escaping any of the above special characters by preceding it with a '\'.

If you have cloned the git repository, then you should first run ./autogen.sh
to generate the configure script.

If you have unpacked the source code from a tarball, then you can just follow
the standard 'configure; make; make install' recipe to install the library.

To take it for a quick test drive, just run the bash_pattern_test program.

$ bash_pattern_test
Usage: bash_pattern_test 'pattern' 'text'

$ bash_pattern_test 'Hello, {l{on,ov}e}ly {world,planet}.' 'Hello, lovely world.'
Compiling pattern: Hello, {l{on,ov}e}ly {world,planet}.
Matching against text: Hello, lovely world.
Match: YES
Freeing pattern