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.
- Host: GitHub
- URL: https://github.com/lpsinger/bash_pattern
- Owner: lpsinger
- License: gpl-3.0
- Created: 2012-09-29T02:09:10.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2015-09-24T20:36:48.000Z (about 10 years ago)
- Last Synced: 2025-02-10T21:45:36.498Z (11 months ago)
- Language: C
- Size: 195 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
- License: COPYING
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