Lots of info here:

http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/regexp.htm

Here's a quick summary:

Anything in [] is a character class - it matches one character only. [0-9]
matches any digit. [a-zA-Z] matches any letter. Syntax inside a character
class is very different from regular regex syntax. Inside a char class, type
any chars you want to match or use hyphens to create a range, or ^ at the
start of a class to match anything but.

Use parentheses and bars for alternatives - cand(y|ies) matches both candy
and candies.

Add a + for one or more matches: a+ matches one or more a's.

Add a * for zero or more matches: a* matches zero or more a's.

Add a ? for an optional bit: a? matches zero or one or a's.

a{3} matches 3 a's.

[0-9]{6,8} matches a number between 6 and 8 digits in length.

. matches anything.

^ matches start of string

$ matches end of string.

To use one of the characters above to match itself, escape it with a
preceding \ -- \. Matches a dot.

Regexes by default try to match the longest string possible - this is called
"greedy" matching.





  _____  

From: Mystic [mailto:[EMAIL PROTECTED]
Sent: Thursday, 1 July 2004 12:57 p.m.
To: CF-Talk
Subject: Re: CFINPUT pattern question - Thank you!!

Thanks!

Can you also point me to where I can get a list of what each symbol and char
means? Like what you did for me but all of the possible options. :-) Or even
a good tutorial or site that I can learn the whole regex from.

Thanks again,
Kevin
  ----- Original Message -----
  From: Matthew Walker
  A regex to match that is: ^\$[0-9]\.[0-9]{2}$

  Note that $ and . are special regex characters so must be "escaped". It
  means this:

  ^                       start

  \$                     dollar sign

  [0-9]                  first digit

  \.                      Decimal point

  [0-9]{2}              second and third digits

  $                      end

  _____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to