[Top][All Lists]

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

Re: AWK problem finding backslash

From: Andreas Schwab
Subject: Re: AWK problem finding backslash
Date: Sat, 09 Apr 2005 16:44:03 +0200
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/22.0.50 (gnu/linux)

"Joe Kolman" <address@hidden> writes:

> if (len10 >= 41) {sub("\\","",old_value); printf("\nentered len10")}

"\\" represents an incomplete regexp.  After stripping the quoting for a
string literal the resulting regexp contains a single backslash, which is
a quoting character in the regexp language.  To match a backslash you need
to quote it with a backslash, which, after adding the necessary quoting
for a string literal, becomes "\\\\".  Note that there are two levels of
quoting, one level for the string syntax and one level for the regexp
syntax, and both are using the same quoting character, the backslash.


Andreas Schwab, SuSE Labs, address@hidden
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

reply via email to

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