unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* displaying control characters/regex help
@ 2006-11-08 22:07 Peter
  2006-11-09 18:59 ` Kevin Rodgers
  0 siblings, 1 reply; 2+ messages in thread
From: Peter @ 2006-11-08 22:07 UTC (permalink / raw)


Hi - I'd like to know if Emacs has the ability to display control
(non-printing) characters (as in Word, where it is possible to hit a
button and see representations of all the non-printing characters).  I
may not actually need it for the problem I'm working on, but it would
be nice to know - what I'm actually trying to accomplish is a global
search-and-replace...I'm looking to replace:

Any amount of whitespace (spaces, tabs, carriage returns), followed by
either one or two digits, followed by any amount of whitespace,
followed by a fixed string, followed by (possibly) more
whitespace. There would be regular text (word characters) on either
side of this regex region. (I'm trying to clean up a document that was
saved-as-text from Acroread, that had a page number and a fixed footer
on each page).

Sample:

-----boundary-----

34


My string is quite stringy.


-----boundary-----

I want to replace the entire mess between the boundaries with just a
carriage return.

Can I get a push in the right direction, please?

Thanks much -

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

* Re: displaying control characters/regex help
  2006-11-08 22:07 displaying control characters/regex help Peter
@ 2006-11-09 18:59 ` Kevin Rodgers
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Rodgers @ 2006-11-09 18:59 UTC (permalink / raw)


Peter wrote:
> Hi - I'd like to know if Emacs has the ability to display control
> (non-printing) characters (as in Word, where it is possible to hit a
> button and see representations of all the non-printing characters).

See the Text Display node of the Emacs manual, and follow its reference
to the Display Tables node of the Emacs Lisp manual and its subnodes.

> I
> may not actually need it for the problem I'm working on, but it would
> be nice to know - what I'm actually trying to accomplish is a global
> search-and-replace...I'm looking to replace:
 >
> Any amount of whitespace (spaces, tabs, carriage returns), followed by
> either one or two digits, followed by any amount of whitespace,
> followed by a fixed string, followed by (possibly) more
> whitespace. There would be regular text (word characters) on either
> side of this regex region. (I'm trying to clean up a document that was
> saved-as-text from Acroread, that had a page number and a fixed footer
> on each page).
> 
> Sample:
> 
> -----boundary-----
> 
> 34
> 
> 
> My string is quite stringy.
> 
> 
> -----boundary-----
> 
> I want to replace the entire mess between the boundaries with just a
> carriage return.

C-M-% \s-*[0-9]\{1,2\}\s-*My SPC string SPC is SPC quite SPC stringy 
\s-* RET C-q C-j RET

If you want to match the fixed string exactly, use `C-q SPC' instead of
just `SPC'.

-- 
Kevin

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

end of thread, other threads:[~2006-11-09 18:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-08 22:07 displaying control characters/regex help Peter
2006-11-09 18:59 ` Kevin Rodgers

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