我正在尋找其中有撇號的線條,並嘗試了一些看起來與我完全相同的表達方式;然而,有些人工作,其他人沒有。爲什麼我會得到以下行爲:這些正則表達式爲什麼不同?
egrep \' file # works as expected
egrep "\'" file # seems to return all lines
egrep "[\']" file # works as expected
egrep '\'' file # seems to be waiting for more input
您的措辭有點誤導:_escaping with quotes_ sounds like you're _using_ quotes escape。好的建議重新:使用'回聲'來理清發生了什麼 – pb2q 2012-07-28 07:21:09
你會如何逃避單引號中的字符? – bqui56 2012-07-28 07:25:01