Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16793 > unrolled thread

Re: How anchor to line end in regex

Started byLawrence Velázquez <vq@larryv.me>
First post2020-08-22 22:40 -0400
Last post2020-08-22 22:40 -0400
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: How anchor to line end in regex Lawrence Velázquez <vq@larryv.me> - 2020-08-22 22:40 -0400

#16793 — Re: How anchor to line end in regex

FromLawrence Velázquez <vq@larryv.me>
Date2020-08-22 22:40 -0400
SubjectRe: How anchor to line end in regex
Message-ID<mailman.829.1598150455.2469.bug-bash@gnu.org>
Hi,

> On Aug 22, 2020, at 10:13 PM, Budi <budikusasi@gmail.com> wrote:
> 
> How anchor to line end in bash regex [[ ]]
> h=hi
> [[ $h =~ ^hi\$ ]] && echo Yes
> 
> cannot work, or is it bug yet

Special characters are matched literally if they are quoted, so you
just have to make sure the $ is not quoted.

	$ h=hi
	$ [[ $h =~ ^hi\$ ]] && echo Yes
	$ [[ $h =~ ^hi$ ]] && echo Yes
	Yes

vq

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web