Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Mac > Mac Programmer > Re: Help with R...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 15 of 16 Topic 986 of 1040
Post > Topic >>

Re: Help with RegEx?

by dempson@[EMAIL PROTECTED] (David Empson) Jan 11, 2008 at 12:03 PM

SparkyGuy <sparkyguy@[EMAIL PROTECTED]
> wrote:

> It turns out that simple range expressions are not sup****ted in this
(very)
> limited set of RegEx:
> 
> "\{m,n\}      Matches the preceding element at least m and not more than
n times.
> For example, a\{3,5\} matches only "aaa", "aaaa", and "aaaaa". ***This
is not
> found in a few, older instances of regular expressions.***"
> (Emphasis mine.)

That notation is wrong. For extended regular expressions (specifically
"Perl Compatible Regular Expressions"), the curly braces should NOT be
preceded by a backslash. The backslash means "ignore the special meaning
of the next character and treat it as a normal character" (or treat a
normal characgter as a special character, such as \s for space).

The correct syntax for "match at least m but no more than n of any
character" is

..{m,n}

If you used this:

..\{m,n\}

it would mean "match any character, then a "{", then m, then a comma,
then n, then a "}".

If your regular expression engine only sup****ts basic regular
expressions then the "{" and "}" characters have no special meaning and
are treated as normal characters. A backslash in front of them will just
be ignored.

-- 
David Empson
dempson@[EMAIL PROTECTED]

 




 16 Posts in Topic:
Help with RegEx?
SparkyGuy <sparkyguy@[  2008-01-05 23:07:58 
Re: Help with RegEx?
SparkyGuy <sparkyguy@[  2008-01-06 01:43:11 
Re: Help with RegEx?
dempson@[EMAIL PROTECTED]  2008-01-06 15:06:06 
Re: Help with RegEx?
SM Ryan <wyrmwif@[EMAI  2008-01-06 01:43:13 
Re: Help with RegEx?
Reinder Verlinde <rein  2008-01-06 15:25:24 
Re: Help with RegEx?
Paul Floyd <root@[EMAI  2008-01-06 15:25:32 
Re: Help with RegEx?
Ben Artin <macdev@[EMA  2008-01-08 21:27:23 
Re: Help with RegEx?
SparkyGuy <sparkyguy@[  2008-01-09 01:15:16 
Re: Help with RegEx?
dempson@[EMAIL PROTECTED]  2008-01-09 22:57:18 
Re: Help with RegEx?
SparkyGuy <sparkyguy@[  2008-01-09 18:28:01 
Re: Help with RegEx?
SparkyGuy <sparkyguy@[  2008-01-10 10:25:27 
Re: Help with RegEx?
John Whorfin <_@[EMAIL  2008-01-11 07:11:05 
Re: Help with RegEx?
SparkyGuy <sparkyguy@[  2008-01-10 20:58:02 
Re: Help with RegEx?
SparkyGuy <sparkyguy@[  2008-01-10 21:12:07 
Re: Help with RegEx?
dempson@[EMAIL PROTECTED]  2008-01-11 12:03:31 
Re: Help with RegEx?
Sherman Pendley <spamt  2008-01-10 18:20:34 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Nov 22 9:29:33 CST 2008.