* Re: emacs regexp question
2003-06-04 17:24 emacs regexp question gmayer
@ 2003-06-04 17:19 ` D. Goel
2003-06-04 17:56 ` Jesper Harder
2003-06-04 17:30 ` Kevin Rodgers
1 sibling, 1 reply; 5+ messages in thread
From: D. Goel @ 2003-06-04 17:19 UTC (permalink / raw)
untested answers below, i hope they are not all wrong :-)
> Hello:
>
> There are some regexps I don't know how to specify in gnu emacs:
>
> - How should I ask for the first occurrence of two blank lines?
"\n\n" or C-q C-j C-q C-j if invoking M-x re-search-forward
interactively. -- that command is boundto C-M-s in some modes.
>
> - How should I ask for the first occurrence of N blank lines for some fixed,
> yet large, N.
"\n\n\n\n..." I don't think there's another way to do it using emacs'
regexps. perhaps regexp is not the right approach if N is very large,
and some simple elisp is in order.
> I think emacs uses ^ for the start of the line, though I've seen
> some regexp libraries (not for emacs) that use the ^ as a sort of
> "exponentiation" symbol for the number of times a string is
> concatenated.
>
> - How can I search for regexps that have one or more newlines in the middle?
something like ".*\n.*"
DG http://gnufans.net/
--
^ permalink raw reply [flat|nested] 5+ messages in thread
* emacs regexp question
@ 2003-06-04 17:24 gmayer
2003-06-04 17:19 ` D. Goel
2003-06-04 17:30 ` Kevin Rodgers
0 siblings, 2 replies; 5+ messages in thread
From: gmayer @ 2003-06-04 17:24 UTC (permalink / raw)
Hello:
There are some regexps I don't know how to specify in gnu emacs:
- How should I ask for the first occurrence of two blank lines?
- How should I ask for the first occurrence of N blank lines for some fixed,
yet large, N. I think emacs uses ^ for the start of the line, though I've
seen some regexp libraries (not for emacs) that use the ^ as a sort of
"exponentiation" symbol for the number of times a string is concatenated.
- How can I search for regexps that have one or more newlines in the middle?
Brief explanations and/or brief examples of the above would greatly be
appreciated!
Thanks,
Mayer (gmayer@cs.bgu.ac.il)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: emacs regexp question
2003-06-04 17:24 emacs regexp question gmayer
2003-06-04 17:19 ` D. Goel
@ 2003-06-04 17:30 ` Kevin Rodgers
1 sibling, 0 replies; 5+ messages in thread
From: Kevin Rodgers @ 2003-06-04 17:30 UTC (permalink / raw)
gmayer@cs.bgu.ac.il wrote:
> - How should I ask for the first occurrence of two blank lines?
interactively: ^ C-q C-j C-q C-j
programmatically: "^\n\n"
> - How should I ask for the first occurrence of N blank lines for some fixed,
> yet large, N. I think emacs uses ^ for the start of the line, though I've
> seen some regexp libraries (not for emacs) that use the ^ as a sort of
> "exponentiation" symbol for the number of times a string is concatenated.
interactively: ^ C-q C-j \{ N \}
programmatically: "^\n\\{N\\}"
> - How can I search for regexps that have one or more newlines in the middle?
interactively: \( .* C-q C-j \)*
programmatically: "\\(.*\n\\)*"
--
<a href="mailto:<kevin.rodgers@ihs.com>">Kevin Rodgers</a>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: emacs regexp question
2003-06-04 17:19 ` D. Goel
@ 2003-06-04 17:56 ` Jesper Harder
2003-06-04 18:07 ` D. Goel
0 siblings, 1 reply; 5+ messages in thread
From: Jesper Harder @ 2003-06-04 17:56 UTC (permalink / raw)
D. Goel <deego@gnufans.org> writes:
>> - How should I ask for the first occurrence of N blank lines for
>> some fixed, yet large, N.
>
> "\n\n\n\n..." I don't think there's another way to do it using emacs'
> regexps.
You can use the \{M\} postfix operator (M integer).
So e.g. "\n\\{500\\}" would match exactly 500 blank lines.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: emacs regexp question
2003-06-04 17:56 ` Jesper Harder
@ 2003-06-04 18:07 ` D. Goel
0 siblings, 0 replies; 5+ messages in thread
From: D. Goel @ 2003-06-04 18:07 UTC (permalink / raw)
> > "\n\n\n\n..." I don't think there's another way to do it using emacs'
> > regexps.
>
> You can use the \{M\} postfix operator (M integer).
Thanks Jesper.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2003-06-04 18:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-04 17:24 emacs regexp question gmayer
2003-06-04 17:19 ` D. Goel
2003-06-04 17:56 ` Jesper Harder
2003-06-04 18:07 ` D. Goel
2003-06-04 17:30 ` Kevin Rodgers
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.