unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* replacing whitespace (regexp question)
@ 2003-02-17 18:28 Henry Chan
  2003-02-17 19:49 ` Kai Großjohann
  2003-02-18 13:21 ` Kevin Dziulko
  0 siblings, 2 replies; 3+ messages in thread
From: Henry Chan @ 2003-02-17 18:28 UTC (permalink / raw)


How do I replace the whitespace at the beginning of a line with nothing
i.e.
I want to perform something like:
$str =~ s#^\s+##;

thx,
Henry
q8e192@yahoo.com

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

* Re: replacing whitespace (regexp question)
  2003-02-17 18:28 replacing whitespace (regexp question) Henry Chan
@ 2003-02-17 19:49 ` Kai Großjohann
  2003-02-18 13:21 ` Kevin Dziulko
  1 sibling, 0 replies; 3+ messages in thread
From: Kai Großjohann @ 2003-02-17 19:49 UTC (permalink / raw)


q8e192@yahoo.com (Henry Chan) writes:

> How do I replace the whitespace at the beginning of a line with nothing
> i.e.
> I want to perform something like:
> $str =~ s#^\s+##;

First of all, you can replace the regexp ^\s-+ with nothing, using
query-replace-regexp.

Secondly, C-x h C-u - 999 C-x C-i might be useful, as well.  (If you
have lines starting with more than 999 spaces, it won't work.  But
I'm sure you can guess what to do in that case.)
-- 
A turnip curses Elvis

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

* Re: replacing whitespace (regexp question)
  2003-02-17 18:28 replacing whitespace (regexp question) Henry Chan
  2003-02-17 19:49 ` Kai Großjohann
@ 2003-02-18 13:21 ` Kevin Dziulko
  1 sibling, 0 replies; 3+ messages in thread
From: Kevin Dziulko @ 2003-02-18 13:21 UTC (permalink / raw)


You can use:

M-x replace-regexp

then at the prompt type:
^ +

then at the second prompt, don't type any thing, just hit enter.

Hope this helps.


On 17 Feb 2003, Henry Chan wrote:

> How do I replace the whitespace at the beginning of a line with nothing
> i.e.
> I want to perform something like:
> $str =~ s#^\s+##;
> 
> thx,
> Henry
> q8e192@yahoo.com
> _______________________________________________
> Help-gnu-emacs mailing list
> Help-gnu-emacs@gnu.org
> http://mail.gnu.org/mailman/listinfo/help-gnu-emacs
> 

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

end of thread, other threads:[~2003-02-18 13:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-17 18:28 replacing whitespace (regexp question) Henry Chan
2003-02-17 19:49 ` Kai Großjohann
2003-02-18 13:21 ` Kevin Dziulko

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