I'm trying to get regular expression matching working on both bash v3
as well as v4.

The following works on v4 (under RHEL6), but not under bash 3.00.15
(under RHEL4):

[[ "6Server" =~ ([0-9]+)(.*) ]]

This works on 3.00.15, but not under RHEL6's bash (4.1.2):

[[ "6Server" =~ '([0-9]+)(.*)' ]]

The prior actually throws a syntax error, so I can't even code around
the syntax based on evaluation of $BASH_VERSINFO.

Any thoughts on how to do this in a portable way?

Thanks,
Ray

Reply via email to