all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: goncholden <goncholden@protonmail.com>
To: Robert Pluim <rpluim@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Making a regex string that matches (
Date: Thu, 10 Mar 2022 17:14:57 +0000	[thread overview]
Message-ID: <JO60EMe2_V2IFCKjFg585c3Va1An0uIOVKfYq8A11t2UOLdmjcfIRZRDySFRxT_s4LavmoZbqEddi7RlFL4qVpLTOEUhRQUJpjGT3WzZyHA=@protonmail.com> (raw)
In-Reply-To: <87tuc5g61n.fsf@gmail.com>

------- Original Message -------
On Thursday, March 10th, 2022 at 3:51 PM, Robert Pluim <rpluim@gmail.com> wrote:
> > > > > > On Thu, 10 Mar 2022 15:39:03 +0100, Emanuel Berg via Users list for the GNU Emacs text editor help-gnu-emacs@gnu.org said:
>
> Emanuel> angelomolina--- via Users list for the GNU Emacs text editor wrote:
>
> >> How can I make a regex string if I want to search for (.
>
> Emanuel> Uhm ... how much is a 50¢ stamp?
>
> Emanuel> (re-search-forward "(")
>
> And since youʼre searching for a literal '(', you can use
>
> `search-forward'.
>
> Robert

Have come up with the following function.  Would this be enough to count the number
oy opening parantheses in a region ?

(defun bracketing-count (region-start region-end)
  "Counts opening and closing bracketing marks.
Interactive functions enable them to be called using `M-x`"
  (interactive "r")  ; gets region start and end

  (message "Counting bracketing marks ...")
  (save-excursion
    (let (count)
      (setq count 0)
      (goto-char region-start)

      (while (and (< (point) region-end)
		  (search-forward "\(" region-end t))
        (setq count (1+ count))) ))))






  reply	other threads:[~2022-03-10 17:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-10 13:36 Making a regex string that matches ( angelomolina--- via Users list for the GNU Emacs text editor
2022-03-10 14:39 ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-03-10 15:51   ` Robert Pluim
2022-03-10 17:14     ` goncholden [this message]
2022-03-10 17:48       ` Eric Abrahamsen
2022-03-10 17:57       ` [External] : " Drew Adams
2022-03-10 18:54         ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-03-10 18:03       ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-03-11 12:24       ` Leo Butler
2022-03-11 19:53         ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-03-10 15:13 ` Leo Butler
2022-03-11 23:43 ` Eduardo Ochs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='JO60EMe2_V2IFCKjFg585c3Va1An0uIOVKfYq8A11t2UOLdmjcfIRZRDySFRxT_s4LavmoZbqEddi7RlFL4qVpLTOEUhRQUJpjGT3WzZyHA=@protonmail.com' \
    --to=goncholden@protonmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=rpluim@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.