all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Joe Corneli <jcorneli@math.utexas.edu>
Subject: multiple alternatives regexp question
Date: Tue, 06 Jan 2004 19:19:55 -0600	[thread overview]
Message-ID: <E1Ae2MV-0007nZ-00@lab45.ma.utexas.edu> (raw)
In-Reply-To: <E1Ae1Fl-0004fM-Lz@monty-python.gnu.org> (help-gnu-emacs-request@gnu.org)

I am interested in a regexp that I think should be written
like this (for inclusion in a program):

"\\([[:lower:]]\\|[[:digit:]]\\|A\\)\\([A-Z]\\)"

In other words, a lower case letter, or a digit, or an `A',
followed by a capital letter.

Unfortunately, when I search and replace like so:

(let ((case-fold-search nil))
(while (re-search-forward "\\([[:lower:]]\\|[[:digit:]]\\|A\\)\\([A-Z]\\)"
                          nil t)
  (replace-match (concat (match-string 1) " " (match-string 2)))))

on something
like 

ProofOfPropertiesOfTraceOfAMatrix 

I get back

Proof Of Properties Of Trace Of AMatrix 
                                 ^

(Note that if you run the above code on the output string, it will
make a space in the appropriate place!)

Why is the `A' not being treated the way I want the first time
around?

       reply	other threads:[~2004-01-07  1:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1Ae1Fl-0004fM-Lz@monty-python.gnu.org>
2004-01-07  1:19 ` Joe Corneli [this message]
     [not found] ` <mailman.87.1073442133.928.help-gnu-emacs@gnu.org>
2004-01-07  2:14   ` multiple alternatives regexp question Jesper Harder
2004-01-07 10:13   ` Stefan Monnier
     [not found] <E1AeGBR-00015s-IU@monty-python.gnu.org>
2004-01-07 16:57 ` Joe Corneli

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=E1Ae2MV-0007nZ-00@lab45.ma.utexas.edu \
    --to=jcorneli@math.utexas.edu \
    /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.