[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Cross-version regular expression...

From: Ray Van Dolson
Subject: Cross-version regular expression...
Date: Wed, 13 Apr 2011 11:19:22 -0700
User-agent: Mutt/1.5.21 (2010-09-15)

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?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]