Portable Bash regular expression matching image
6.5K
This image was created out of the need for portable regular expression matching in sh scripts.
stdin or the second argument given with a given regular expression using Bash's regular expression matching.
If matching from stdin, the only argument given should be the regular expression, otherwise the second argument will be matched against the regular expression and stdin will be ignored.0, are echoed to stdout, separated by a space by default.MATCH_DELIM to your desired delimiter.0 if a match, else a nonzero value.$ docker run --rm -it matthewadams12/match '^(i)(t)$' it
it i t
stdin$ echo it | docker run --rm -i matthewadams12/match '^(i)(t)$'
it i t
$ echo it | docker run --rm -i -e MATCH_DELIM=';' matthewadams12/match '^(i)(t)$'
it;i;t
$ docker run --rm -it matthewadams12/match '^it$' it
it
$ echo $?
0
$ docker run --rm -it matthewadams12/match '^not it$' it
$ echo $?
1
Content type
Image
Digest
Size
5.9 MB
Last updated
about 8 years ago
docker pull matthewadams12/match