* what means "\\s-" used as a regexp?
@ 2006-08-05 11:38 stefano.sabatini-lala
2006-08-05 11:57 ` Ralf Angeli
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: stefano.sabatini-lala @ 2006-08-05 11:38 UTC (permalink / raw)
Hello everybody.
I recently found in some code the use of "\\s-". Documentation
appearantly said nothing on it.
(string-match "\\s-" "hello world")
==>5
(string-match "\\s-" "hello\\tworld")
==>nil
(string-match "\\s-" "hello\\nworld")
==>nil
So it seems "\\s-" match only the space.
But I still doesn't understand the meaning of the hypen at the end of
the
regexp "\\s-".
(string-match "\\s" "hello world")
returns the error: (invalid-regexp "Premature end of regular
expression")
Thank you.
--stefano
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: what means "\\s-" used as a regexp?
2006-08-05 11:38 what means "\\s-" used as a regexp? stefano.sabatini-lala
@ 2006-08-05 11:57 ` Ralf Angeli
2006-08-05 11:59 ` Michaël Cadilhac
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Ralf Angeli @ 2006-08-05 11:57 UTC (permalink / raw)
* stefano sabatini-lala (2006-08-05) writes:
> I recently found in some code the use of "\\s-". Documentation
> appearantly said nothing on it.
(info "(elisp)Regexp Backslash")
--
Ralf
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: what means "\\s-" used as a regexp?
2006-08-05 11:38 what means "\\s-" used as a regexp? stefano.sabatini-lala
2006-08-05 11:57 ` Ralf Angeli
@ 2006-08-05 11:59 ` Michaël Cadilhac
2006-08-05 12:19 ` Eli Zaretskii
[not found] ` <mailman.4894.1154780361.9609.help-gnu-emacs@gnu.org>
3 siblings, 0 replies; 5+ messages in thread
From: Michaël Cadilhac @ 2006-08-05 11:59 UTC (permalink / raw)
Cc: help-gnu-emacs
[-- Attachment #1.1: Type: text/plain, Size: 1377 bytes --]
stefano.sabatini-lala@poste.it writes:
> Hello everybody.
>
> I recently found in some code the use of "\\s-". Documentation
> appearantly said nothing on it.
>
> (string-match "\\s-" "hello world")
> ==>5
>
> (string-match "\\s-" "hello\\tworld")
> ==>nil
>
> (string-match "\\s-" "hello\\nworld")
> ==>nil
>
> So it seems "\\s-" match only the space.
> But I still doesn't understand the meaning of the hypen at the end of
> the
> regexp "\\s-".
>
> (string-match "\\s" "hello world")
> returns the error: (invalid-regexp "Premature end of regular
> expression")
,----[ (info "(Elisp)Regexp Backslash") ]
| `\sCODE'
| matches any character whose syntax is CODE. Here CODE is a
| character that represents a syntax code: thus, `w' for word
| constituent, `-' for whitespace, `(' for open parenthesis, etc.
| To represent whitespace syntax, use either `-' or a space
| character. *Note Syntax Class Table::, for a list of syntax codes
| and the characters that stand for them.
`----
--
| Michaël `Micha' Cadilhac | Would someone please DTRT with this, |
| Epita/LRDE Promo 2007 | then ACK? |
| http://www.lrde.org/~cadilh_m | -- Richard Stallman |
`-- - JID: micha@amessage.be --' - --'
[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]
[-- Attachment #2: Type: text/plain, Size: 152 bytes --]
_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: what means "\\s-" used as a regexp?
2006-08-05 11:38 what means "\\s-" used as a regexp? stefano.sabatini-lala
2006-08-05 11:57 ` Ralf Angeli
2006-08-05 11:59 ` Michaël Cadilhac
@ 2006-08-05 12:19 ` Eli Zaretskii
[not found] ` <mailman.4894.1154780361.9609.help-gnu-emacs@gnu.org>
3 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2006-08-05 12:19 UTC (permalink / raw)
> From: stefano.sabatini-lala@poste.it
> Date: 5 Aug 2006 04:38:51 -0700
>
> I recently found in some code the use of "\\s-". Documentation
> appearantly said nothing on it.
It does on my system:
`\sC'
matches any character whose syntax is C. Here C is a character
that designates a particular syntax class: thus, `w' for word
constituent, `-' or ` ' for whitespace, `.' for ordinary
punctuation, etc. *Note Syntax::.
> So it seems "\\s-" match only the space.
Yes.
^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <mailman.4894.1154780361.9609.help-gnu-emacs@gnu.org>]
* Re: what means "\\s-" used as a regexp?
[not found] ` <mailman.4894.1154780361.9609.help-gnu-emacs@gnu.org>
@ 2006-08-05 13:33 ` stefano.sabatini-lala
0 siblings, 0 replies; 5+ messages in thread
From: stefano.sabatini-lala @ 2006-08-05 13:33 UTC (permalink / raw)
Eli Zaretskii ha scritto:
> > From: stefano.sabatini-lala@poste.it
> > Date: 5 Aug 2006 04:38:51 -0700
> >
> > I recently found in some code the use of "\\s-". Documentation
> > appearantly said nothing on it.
>
> It does on my system:
>
> `\sC'
> matches any character whose syntax is C. Here C is a character
> that designates a particular syntax class: thus, `w' for word
> constituent, `-' or ` ' for whitespace, `.' for ordinary
> punctuation, etc. *Note Syntax::.
Thank you all!
My *info* buffer was opened on that very page, but for some mysterious
reasons I missed that explanation...
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-08-05 13:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-05 11:38 what means "\\s-" used as a regexp? stefano.sabatini-lala
2006-08-05 11:57 ` Ralf Angeli
2006-08-05 11:59 ` Michaël Cadilhac
2006-08-05 12:19 ` Eli Zaretskii
[not found] ` <mailman.4894.1154780361.9609.help-gnu-emacs@gnu.org>
2006-08-05 13:33 ` stefano.sabatini-lala
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.