help-gnu-utils
[Top][All Lists]
Advanced

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

Re: expr, regular expressions and '^' ...


From: Jim Meyering
Subject: Re: expr, regular expressions and '^' ...
Date: Thu, 18 Nov 2004 09:10:31 +0100

aek@netcom.com (aekalman) wrote:
> Is there any way for me to suppress the implicitly prepended '^' in
> the regex? E.g. I have
>
> expr 'sfiaravrt-7s-sf' : '\(-7s\)'
>
> and it fails because -7s is not at the start of the string. How can I
> use expr (or something else entirely) to return what you would get if
> a '^' were not explicitly prepended, i.e. '-7s'?

Sure.  Prepend `.*'

  $ expr 'sfiaravrt-7s-sf' : '.*\(-7s\)'
  -7s




reply via email to

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