From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.help Subject: Re: regular expression Date: Mon, 30 Jun 2014 22:52:41 +0200 Organization: Aioe.org NNTP Server Message-ID: <87y4weglwm.fsf@debian.uxu> References: <871tu6b1uw.fsf@debian.uxu> <87r4269mwa.fsf@debian.uxu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1404161724 29925 80.91.229.3 (30 Jun 2014 20:55:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 30 Jun 2014 20:55:24 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jun 30 22:55:19 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1X1ibf-0002ZX-3o for geh-help-gnu-emacs@m.gmane.org; Mon, 30 Jun 2014 22:55:19 +0200 Original-Received: from localhost ([::1]:36570 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1ibe-0007ad-L1 for geh-help-gnu-emacs@m.gmane.org; Mon, 30 Jun 2014 16:55:18 -0400 Original-Path: usenet.stanford.edu!news.kjsl.com!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!rt.uk.eu.org!aioe.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 33 Original-NNTP-Posting-Host: SIvZRMPqRkkTHAHL6NkRuw.user.speranza.aioe.org Original-X-Complaints-To: abuse@aioe.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-Notice: Filtered by postfilter v. 0.8.2 Cancel-Lock: sha1:b1sc1sSYvE4Ba+SlB7fOLRqO7AY= Mail-Copies-To: never Original-Xref: usenet.stanford.edu gnu.emacs.help:206195 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:98466 Archived-At: Teemu Likonen 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