* ^[$B:G?78D<<3+J|^[(B
@ 2005-11-01 15:23 info
2005-11-02 2:39 ` re-search beginning of line or whitespace Tim Johnson
0 siblings, 1 reply; 8+ messages in thread
From: info @ 2005-11-01 15:23 UTC (permalink / raw)
^[$B$*Hh$lMM$G$9!*:#F|=i$a$F;XL>$r<u$1$?5.J}$K^[(B2^[$B%7%g%C%H@lMQ^[(B
VIP^[$B%k!<%`$r$4MQ0UCW$7$^$7$?!#;XL><T^[(B ^[$BFbED!!6A;R!!^[(B32^[$B:P^[(B
^[$B!!^[(BE^[$B%+%C%W!!^[(B
ID^[$B!Z^[(B161690^[$B![$G$9!#H`=w$+$i!XN%:'$7$F$+$i^[(B2^[$BG/$G$9!#0l?MJk$i$7^[(B
^[$B$NIt20$GBT$C$F$^$9!#:#Fs$D$NH~MF1!7P1D$7$F$^$9$N$G!"!"$*6b^[(B
^[$B$rM>$7$F$^$9!#^[(B
^[$B5U!}^[(BOK^[$B$G$9!*!Y$H$$$&%a%C%;!<%8$,F~$j$^$7$?!#^[(B
^[$B;XL>$r<u$1$?5.J}$N@lMQ%k!<%`%J%s%P!<!Z^[(B251^[$B![$G$9^[(B!
^[$B@lMQ%-!<^[(B http://www.arigatouo.net?251
^[$BCm!'%K%C%/%M!<%`$N:G8e$K!Z^[(B251^[$B![$r$DIU$1$F$$$?$@$1$l$P!"$9^[(B
^[$B$0O"Mm<h$l$k$h!#$7^[(B
^[$B$+$b2a7c<L%a8r49<+M3^[(B!^[$BH`=w==J,$JA06b$rJ'$C$?$?$aFs?M$G<YKb^[(B
^[$B$5$l$:$f$C$/$j$G$-$^$9$h!#6A;R$O$H$C$/$KBT$C$F$$$k$+$i!"$I^[(B
^[$B$&$>!"8f=P$G$/$@$5$$!#^[(B
^[$B8D<<$G?4B!BQ$($J$$J}$*Bg;v$K^[(B
^[$B5qH]!'^[(Bbadluck@arigatouo.net
^ permalink raw reply [flat|nested] 8+ messages in thread
* re-search beginning of line or whitespace
2005-11-01 15:23 ^[$B:G?78D<<3+J|^[(B info
@ 2005-11-02 2:39 ` Tim Johnson
2005-11-02 3:23 ` Neon Absentius
0 siblings, 1 reply; 8+ messages in thread
From: Tim Johnson @ 2005-11-02 2:39 UTC (permalink / raw)
Hi:
I'd like to find the nearest previous whitespace *or*
beginning of line;
(re-search-backward "^") ;; gets me to the beginning of
;; the line
(re-search-backward "[\t ]") ;; seems to find the nearest
;; previous whitespace
;; but can't seem to combine them properly
(re-search-backward "^\|[\t ]") ;; gives me an error
What am I leaving out.
TIA
tim
--
Tim Johnson <tim@johnsons-web.com>
http://www.alaska-internet-solutions.com
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: re-search beginning of line or whitespace
2005-11-02 2:39 ` re-search beginning of line or whitespace Tim Johnson
@ 2005-11-02 3:23 ` Neon Absentius
2005-11-02 17:19 ` Tim Johnson
0 siblings, 1 reply; 8+ messages in thread
From: Neon Absentius @ 2005-11-02 3:23 UTC (permalink / raw)
On Tue, Nov 01, 2005 at 05:39:46PM -0900, thus spake Tim Johnson:
> (re-search-backward "^\|[\t ]") ;; gives me an error
>
> What am I leaving out.
A slash ;)
The correct syntax is (re-search-backward "^\\|[\t ]") with your
syntax you are searcing for a line starting with a pipe ("|") and
continuing with white space. Appanently your buffer doesn't contain
such a line.
> TIA
> tim
--
Computer science is not about computers, any more than astronomy is
about telescopes.
-- Edsger Dijkstra
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: re-search beginning of line or whitespace
2005-11-02 3:23 ` Neon Absentius
@ 2005-11-02 17:19 ` Tim Johnson
2005-11-03 20:33 ` Neon Absentius
[not found] ` <mailman.13851.1131050044.20277.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 8+ messages in thread
From: Tim Johnson @ 2005-11-02 17:19 UTC (permalink / raw)
* Neon Absentius <absent@sdf.lonestar.org> [051101 18:30]:
> On Tue, Nov 01, 2005 at 05:39:46PM -0900, thus spake Tim Johnson:
> > (re-search-backward "^\|[\t ]") ;; gives me an error
> >
> > What am I leaving out.
>
> A slash ;)
Thanks Neon:
> The correct syntax is (re-search-backward "^\\|[\t ]") with your
> syntax you are searcing for a line starting with a pipe ("|") and
> continuing with white space. Appanently your buffer doesn't contain
> such a line.
Let me see if I understand the logic of this strange creature called
"regular expressions":
"^" ;; match beginning of line
"\\|" ;; seperator for alternatives
"[\t ]" ;; match any of: TAB, SPACE
Am I correct?
I get confused by the way that emacs "escapes" metacharacters.
Thanks again
tim
--
Tim Johnson <tim@johnsons-web.com>
http://www.alaska-internet-solutions.com
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: re-search beginning of line or whitespace
2005-11-02 17:19 ` Tim Johnson
@ 2005-11-03 20:33 ` Neon Absentius
2005-11-04 16:38 ` Info [was Re: re-search beginning of line or whitespace] Tim Johnson
[not found] ` <mailman.13851.1131050044.20277.help-gnu-emacs@gnu.org>
1 sibling, 1 reply; 8+ messages in thread
From: Neon Absentius @ 2005-11-03 20:33 UTC (permalink / raw)
On Wed, Nov 02, 2005 at 08:19:14AM -0900, thus spake Tim Johnson:
> Let me see if I understand the logic of this strange creature called
> "regular expressions":
>
> "^" ;; match beginning of line
> "\\|" ;; seperator for alternatives
> "[\t ]" ;; match any of: TAB, SPACE
>
It should really be two slashes: [\\t ]. That escaped me ;).
> Am I correct?
> I get confused by the way that emacs "escapes" metacharacters.
It is explained nicely in the elisp manual:
,----[ (info "(elisp) Regexp Special") ]
| `\'
| has two functions: it quotes the special characters (including
| `\'), and it introduces additional special constructs.
|
| Because `\' quotes special characters, `\$' is a regular
| expression that matches only `$', and `\[' is a regular expression
| that matches only `[', and so on.
|
| Note that `\' also has special meaning in the read syntax of Lisp
| strings (*note String Type::), and must be quoted with `\'. For
| example, the regular expression that matches the `\' character is
| `\\'. To write a Lisp string that contains the characters `\\',
| Lisp syntax requires you to quote each `\' with another `\'.
| Therefore, the read syntax for a regular expression matching `\'
| is `"\\\\"'.
`----
You see, for the regular expression parser of emacs certain
characters have to be escaped for example "|" when one uses it to
indicate disjunction, so you write it "\|". However when you write
a Lisp program the regexp is entered as a string, and since "\" is
an elisp escape character a sting that contains "\|" is interpreted
as "|". You don't want that, you want the string to pass to the
"regexp machine" as is, you want the regexp to have "\|"; therefore
you have to escape the slash thus "\\|".
I hope this makes some sense.
>
> Thanks again
> tim
>
> --
> Tim Johnson <tim@johnsons-web.com>
> http://www.alaska-internet-solutions.com
>
>
> _______________________________________________
> Help-gnu-emacs mailing list
> Help-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
--
Computer science is not about computers, any more than astronomy is
about telescopes.
-- Edsger Dijkstra
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: re-search beginning of line or whitespace
[not found] ` <mailman.13851.1131050044.20277.help-gnu-emacs@gnu.org>
@ 2005-11-04 1:05 ` Johan Bockgård
2005-11-04 1:47 ` Neon Absentius
0 siblings, 1 reply; 8+ messages in thread
From: Johan Bockgård @ 2005-11-04 1:05 UTC (permalink / raw)
Neon Absentius <absent@sdf.lonestar.org> writes:
>> "[\t ]" ;; match any of: TAB, SPACE
>
> It should really be two slashes: [\\t ]. That escaped me ;).
No, it shouldn't. \\t is a backslash character followed by a t. \t is
the read syntax for a tab character.
--
Johan Bockgård
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: re-search beginning of line or whitespace
2005-11-04 1:05 ` re-search beginning of line or whitespace Johan Bockgård
@ 2005-11-04 1:47 ` Neon Absentius
0 siblings, 0 replies; 8+ messages in thread
From: Neon Absentius @ 2005-11-04 1:47 UTC (permalink / raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=iso-8859-7, Size: 512 bytes --]
On Fri, Nov 04, 2005 at 02:05:32AM +0100, thus spake Johan Bockg?rdÿ:
> Neon Absentius <absent@sdf.lonestar.org> writes:
>
> >> "[\t ]" ;; match any of: TAB, SPACE
> >
> > It should really be two slashes: [\\t ]. That escaped me ;).
>
> No, it shouldn't. \\t is a backslash character followed by a t. \t is
> the read syntax for a tab character.
>
Yes indeed.
Oops!
--
Computer science is not about computers, any more than astronomy is
about telescopes.
-- Edsger Dijkstra
^ permalink raw reply [flat|nested] 8+ messages in thread
* Info [was Re: re-search beginning of line or whitespace]
2005-11-03 20:33 ` Neon Absentius
@ 2005-11-04 16:38 ` Tim Johnson
0 siblings, 0 replies; 8+ messages in thread
From: Tim Johnson @ 2005-11-04 16:38 UTC (permalink / raw)
* Neon Absentius <absent@sdf.lonestar.org> [051103 11:45]:
> On Wed, Nov 02, 2005 at 08:19:14AM -0900, thus spake Tim Johnson:
> It is explained nicely in the elisp manual:
>
> ,----[ (info "(elisp) Regexp Special") ]
> | `\'
> | has two functions: it quotes the special characters (including
> | `\'), and it introduces additional special constructs.
> |
> | Because `\' quotes special characters, `\$' is a regular
> | expression that matches only `$', and `\[' is a regular expression
> | that matches only `[', and so on.
> |
> | Note that `\' also has special meaning in the read syntax of Lisp
> | strings (*note String Type::), and must be quoted with `\'. For
> | example, the regular expression that matches the `\' character is
> | `\\'. To write a Lisp string that contains the characters `\\',
> | Lisp syntax requires you to quote each `\' with another `\'.
> | Therefore, the read syntax for a regular expression matching `\'
> | is `"\\\\"'.
> `----
>
> You see, for the regular expression parser of emacs certain
> characters have to be escaped for example "|" when one uses it to
> indicate disjunction, so you write it "\|". However when you write
> a Lisp program the regexp is entered as a string, and since "\" is
> an elisp escape character a sting that contains "\|" is interpreted
> as "|". You don't want that, you want the string to pass to the
> "regexp machine" as is, you want the regexp to have "\|"; therefore
> you have to escape the slash thus "\\|".
>
> I hope this makes some sense.
Indeed. Thank you very much Neon.
FYI: I use both Xemacs and GNU emacs. I note that from emacs and
in invoking 'info' from the bash shell that I can not find
a Menu item for emacs or elisp. It looks as if those
components are not installed.
In Xemacs, info provides "Lispref: (lispref)" as a menu
item, which leads me to the regex topic.
For GNU emacs, how may I install these missing items?
cheers
tim
--
Tim Johnson <tim@johnsons-web.com>
http://www.alaska-internet-solutions.com
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2005-11-04 16:38 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-01 15:23 ^[$B:G?78D<<3+J|^[(B info
2005-11-02 2:39 ` re-search beginning of line or whitespace Tim Johnson
2005-11-02 3:23 ` Neon Absentius
2005-11-02 17:19 ` Tim Johnson
2005-11-03 20:33 ` Neon Absentius
2005-11-04 16:38 ` Info [was Re: re-search beginning of line or whitespace] Tim Johnson
[not found] ` <mailman.13851.1131050044.20277.help-gnu-emacs@gnu.org>
2005-11-04 1:05 ` re-search beginning of line or whitespace Johan Bockgård
2005-11-04 1:47 ` Neon Absentius
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.