[Top][All Lists]

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

Re: Regex to match "define ABC-123-xyz"

From: Tim Visher
Subject: Re: Regex to match "define ABC-123-xyz"
Date: Fri, 1 Oct 2010 08:58:23 -0400

Hi Gary,

On Fri, Oct 1, 2010 at 8:10 AM, Gary <> wrote:
> I'm having trouble with this, to say the least. "Obviously" the parts
> after the define aren't fixed, either in content or position. What I
> have tried is
> define [A-Za-z0-9_-]+
> (that is, match the string "define", followed by a single space,
> followed by some string consisting of letters and numbers plus "_" and
> "-") which works except... it doesn't match the numeric part(s). I can
> see this in the regexp builder, and, since I am attempting to match part
> of a programming language syntax, in source code. Kind of
> confusing. What have I done wrong, please?

Don't really understand what's going on.  I type the following into
scratch and use `M-x regex-builder` and it works exactly as I believe
you want it to.

*scratch* contents

define thisIs01Test_with-all_validChars0001

*RE-Builder* contents

define [A-Za-z0-9_-]+

Full match…

Could you provide an actual example of a string you're trying to match
that it isn't matching?


In Christ,

Timmy V. -- Spend less time on mail

reply via email to

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