unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Regexp matching whitespace including newline
@ 2008-09-15 11:43 Nordlöw
  2008-09-15 11:56 ` David Kastrup
  2008-09-15 13:11 ` Thierry Volpiatto
  0 siblings, 2 replies; 5+ messages in thread
From: Nordlöw @ 2008-09-15 11:43 UTC (permalink / raw)
  To: help-gnu-emacs

Is there a more compact regexp for specifying whitespace including
newlines other than:

(re-search-forward (concat "\\(" "\\s-" "\\|" "\n" "\\)*"))

I always use concat() to increase readability of my code.


/Nordlöw


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Regexp matching whitespace including newline
  2008-09-15 11:43 Regexp matching whitespace including newline Nordlöw
@ 2008-09-15 11:56 ` David Kastrup
  2008-09-15 12:27   ` Nordlöw
  2008-09-15 13:11 ` Thierry Volpiatto
  1 sibling, 1 reply; 5+ messages in thread
From: David Kastrup @ 2008-09-15 11:56 UTC (permalink / raw)
  To: help-gnu-emacs

Nordlöw <per.nordlow@gmail.com> writes:

> Is there a more compact regexp for specifying whitespace including
> newlines other than:
>
> (re-search-forward (concat "\\(" "\\s-" "\\|" "\n" "\\)*"))

Uh, (re-search-forward "\\s-") ?

> I always use concat() to increase readability of my code.

That's not quite my impression.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Regexp matching whitespace including newline
  2008-09-15 11:56 ` David Kastrup
@ 2008-09-15 12:27   ` Nordlöw
  2008-09-15 13:12     ` David Kastrup
  0 siblings, 1 reply; 5+ messages in thread
From: Nordlöw @ 2008-09-15 12:27 UTC (permalink / raw)
  To: help-gnu-emacs

> Uh, (re-search-forward "\\s-") ?

\\s- does not match newlines in my Emacs.

/Nordlöw


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Regexp matching whitespace including newline
  2008-09-15 11:43 Regexp matching whitespace including newline Nordlöw
  2008-09-15 11:56 ` David Kastrup
@ 2008-09-15 13:11 ` Thierry Volpiatto
  1 sibling, 0 replies; 5+ messages in thread
From: Thierry Volpiatto @ 2008-09-15 13:11 UTC (permalink / raw)
  To: Nordlöw; +Cc: help-gnu-emacs

Nordlöw <per.nordlow@gmail.com> writes:

> Is there a more compact regexp for specifying whitespace including
> newlines other than:
>
> (re-search-forward (concat "\\(" "\\s-" "\\|" "\n" "\\)*"))

May be that:

,----
| (re-search-forward "[ \n]")
`----


-- 
A + Thierry Volpiatto
Location: Saint-Cyr-Sur-Mer - France




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Regexp matching whitespace including newline
  2008-09-15 12:27   ` Nordlöw
@ 2008-09-15 13:12     ` David Kastrup
  0 siblings, 0 replies; 5+ messages in thread
From: David Kastrup @ 2008-09-15 13:12 UTC (permalink / raw)
  To: help-gnu-emacs

Nordlöw <per.nordlow@gmail.com> writes:

>> Uh, (re-search-forward "\\s-") ?
>
> \\s- does not match newlines in my Emacs.

That depends on the syntax table, and the syntax table tends to depend
on the major mode.  When it makes sense in a particular major mode, it
should tend to match.  For example, it does so in message-mode for me.

What does C-h s show in your favorite mode?

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-09-15 13:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-15 11:43 Regexp matching whitespace including newline Nordlöw
2008-09-15 11:56 ` David Kastrup
2008-09-15 12:27   ` Nordlöw
2008-09-15 13:12     ` David Kastrup
2008-09-15 13:11 ` Thierry Volpiatto

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).