unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Emanuel Berg <embe8573@student.uu.se>
To: help-gnu-emacs@gnu.org
Subject: Re: regular expression
Date: Mon, 30 Jun 2014 22:52:41 +0200	[thread overview]
Message-ID: <87y4weglwm.fsf@debian.uxu> (raw)
In-Reply-To: mailman.4605.1404160609.1147.help-gnu-emacs@gnu.org

Teemu Likonen <tlikonen@iki.fi> writes:

> It's very likely that when one writes [A-Za-z] he
> actually means "match any letter". So it's often
> better to write [[:alpha:]] instead since it also
> matches other letters than A-Z. Sometimes a good
> option is \w which matches word-constituent
> characters as defined in the current syntax table.

I actually think A-Z and so on is clearer to read and
faster to write, but good point, the char classes
probably makes for more "portable" stuff because
[[:alpha:]] includes the Swedish chars ä, å, and ö as
well (and the German, Finnish, etc., I would suppose) -
I don't know if this somehow plays with your locale
(that'd be impressive) or if [[:alpha:]] is just very
generous. Like I said, A-Z is clearer! But you should
use [[:alpha:]], of course - as for this particular
question, there are also [[:upper:]], [[:lower:]],
[[:digit:]], [[:space:]]. Note the double square
brackets - otherwise [:digit:] would be :, d, i, g, i,
t - so it could look like this: [[:alpha:][:digit:]]

(replace-regexp "[[:alpha:][:digit:]]" "x")

One1 (will be xxxx)

PS. Boy, I really hope the OP did as I said and came to
gnu.emacs.help! DS.

-- 
underground experts united:
http://user.it.uu.se/~embe8573


  parent reply	other threads:[~2014-06-30 20:52 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <d5b8df44-60fd-4b8f-83d1-cb7d04b2a7b4@googlegroups.com>
2014-06-30 20:04 ` regular expression Emanuel Berg
2014-06-30 20:13   ` Emanuel Berg
2014-06-30 20:36     ` Teemu Likonen
     [not found]     ` <mailman.4605.1404160609.1147.help-gnu-emacs@gnu.org>
2014-06-30 20:52       ` Emanuel Berg [this message]
2014-06-30 21:04         ` Teemu Likonen
     [not found]         ` <mailman.4609.1404162300.1147.help-gnu-emacs@gnu.org>
2014-06-30 21:11           ` Emanuel Berg
2014-07-02 23:14 Tak Kunihiro
  -- strict thread matches above, loose matches on Subject: below --
2014-07-02 13:10 Tak Kunihiro
2014-07-02 13:43 ` Stefan Monnier
     [not found] <mailman.4622.1404173952.1147.help-gnu-emacs@gnu.org>
2014-07-02  8:33 ` Emanuel Berg
2014-06-30 23:14 Tak Kunihiro
2010-01-25 11:00 Burkhard Schultheis
2010-01-25 12:35 ` Nuno J. Silva
2010-01-25 12:53   ` Helmut Eller
2010-01-26 19:46     ` Nuno J. Silva
2010-01-25 16:34   ` Burkhard Schultheis
2010-01-25 18:12 ` Stefan Monnier

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87y4weglwm.fsf@debian.uxu \
    --to=embe8573@student.uu.se \
    --cc=help-gnu-emacs@gnu.org \
    /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.
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).