help-bash
[Top][All Lists]
Advanced

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

Re: How to match the less-than symbol in regex?


From: Greg Wooledge
Subject: Re: How to match the less-than symbol in regex?
Date: Wed, 18 Mar 2020 08:14:44 -0400
User-agent: Mutt/1.10.1 (2018-07-13)

On Wed, Mar 18, 2020 at 08:05:29AM +0100, Andreas Kusalananda Kähäri wrote:
> On Tue, Mar 17, 2020 at 09:35:42PM -0400, Daniel Mills wrote:
> > $ [[ '9<' =~ ^([0-9]+)<$ ]]
> > -bash: syntax error in conditional expression: unexpected token `<'
> > -bash: syntax error near `^([0-9]+)<$'
> 
> 
> $ [[ '9<' =~ ^([0-9]+)'<'$ ]]; echo $?
> 0

Or:

re='^([0-9]+)<$'
[[ '9<' =~ $re ]]; echo $?



reply via email to

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