From: Andreas Schwab <schwab@suse.de>
Cc: bug-gnu-emacs@gnu.org
Subject: Re: \t not correctly processed in query-replace-regexp
Date: Thu, 16 Sep 2004 17:27:07 +0200 [thread overview]
Message-ID: <jewtyu2q0k.fsf@sykes.suse.de> (raw)
In-Reply-To: <20040916114111.3F79E13F15@ws5-9.us4.outblaze.com> (Paul vL's message of "Thu, 16 Sep 2004 19:41:11 +0800")
"Paul vL" <litter@graffiti.net> writes:
> when using a character class with \t, the \t is not recognised:
> [ \t]+ will not match a sequence of spaces and tabs.
`[ \t]+' is a regexp that matches a sequence of SPC, backslash and `t'.
> using C-q to insert a literal tab character does work;
> [ ]+ will match a sequence of spaces and tabs.
>
> it is stated in the "syntax
> of regular expressions" section of the emacs manual/info file that :
> " `\"' stands for a double-quote as part of
> the regexp, `\\' for a backslash as part of the regexp, `\t' for a tab,
> and `\n' for a newline. "
> and it even gives an example which uses \t for tabs:
> "[.?!][]\"')]*\\($\\| $\\|\t\\| \\)[ \t\n]*"
Here is the complete quote:
In Lisp syntax, the string constant begins and ends with a
double-quote. `\"' stands for a double-quote as part of the regexp,
`\\' for a backslash as part of the regexp, `\t' for a tab, and `\n'
for a newline.
Note that it starts with "In Lisp syntax, the string constant ...",
ie. the paragraph talks about string syntax in Lisp, not about regexp
syntax. The Lisp reader transforms this string constant according to the
quoted rules, and this transformed string is then interpreted by the
regexp engine. The transformation of \t to TAB is only performed at the
Lisp level.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, 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."
prev parent reply other threads:[~2004-09-16 15:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-16 11:41 \t not correctly processed in query-replace-regexp Paul vL
2004-09-16 15:27 ` Andreas Schwab [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jewtyu2q0k.fsf@sykes.suse.de \
--to=schwab@suse.de \
--cc=bug-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).