help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: a question about regular expression


From: Bruno Barbier
Subject: Re: a question about regular expression
Date: 28 Sep 2009 09:54:29 GMT
User-agent: slrn/0.9.9p1 (Linux)

On 2009-09-27, Water Lin <WaterLin@ymail.invalid> wrote:
>
> Here is my code:
> ---------------
> (defun copy-word (&optional arg)
>  "Copy words at point"
>  (interactive "P")
>  (let ((beg (progn (if (looking-back "[_a-zA-Z0-9]" 1)
>                               (backward-word 1)) (point))) 
>       (end (progn (forward-word arg) (point))))
>  (copy-region-as-kill beg end))
> )
> ---------------
>
> I want use M-x copy-word to copy a word even the word is combined by _
> . But I don't know why my regular expression doesn't work.
>
> Not every familiar with elisp, sorry for this stupid question.
>

I use:
 
    M-x re-builder

to build interactively my regular expressions and see what they match.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]