GNU bug report logs - #33418
Convert from literal string to ERE?

Previous Next

Package: grep;

Reported by: Peng Yu <pengyu.ut <at> gmail.com>

Date: Sun, 18 Nov 2018 04:06:01 UTC

Severity: normal

Tags: notabug

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Peng Yu <pengyu.ut <at> gmail.com>
To: bug-grep <at> gnu.org
Subject: Convert from literal string to ERE?
Date: Sat, 17 Nov 2018 22:05:06 -0600
Hi,

I'd like to create an ERE expression for any literal string. I found
that "sed -e 's/\([][?+{|()\]\)/\\\1/g' " seem to work.

For example,
sed -e 's/\([][?+{|()\]\)/\\\1/g' <<< '\?+{|()[]'

Could anybody help confirm whether this will work for all the cases? Thanks.

-- 
Regards,
Peng




This bug report was last modified 5 years and 199 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.