[GRLUG] Bash regex

L. V. Lammert lvl at omnitec.net
Tue May 7 14:48:37 EDT 2013


On Tue, 7 May 2013, Robert Citek wrote:

> > I believe the main problem was the missing 'number' modifier usable in
> > bash, so I had to explictly repeat the digits.
>
> Can you show what you used as a test?
>
2012-06 passes, ..

> $ regex="[0-9]{4}-[0-9]{2}"
> $ [[ "2013-06" =~ ${regex} ]] && echo yes || echo no
> yes
>
Interesting, .. I must not have tested the modifier without quotes - that
DOES work!

	Thanks!!!

	Lee


More information about the grlug mailing list