ODBiC Discussion Board


RE: Match, Dave, 04-17-2007

The [ and ] brackets in a regular expression define a "character class"

by Roger Harris, April 18, 2007 12:39

A "character class" is a specified list of possible single characters that can appear at that position, so "[1ZA]" would mean EITHER a "1", or a "Z" or an "A" in that position, not the literal string "1ZA". For an exact match on a specific character sequence, just put that character sequence directly in the match pattern with no brackets, such as "^1ZA" to match anything beginning with "1ZA" or "^91011" to to match anything beginning with "91011". (Without the ^ at the front, those patterns would match exact substrings anywhere in the input.) An expression like [0-9] in a character class means any character between "0" and "9", and [A-Z] would match any uppercase letter. Please see the Users Guide for more details about match patterns.


Replies:


Post Your Reply:

Name   
E-mail  optional
Topic  
Message:

HTTP Link: 
Link text: 

          


Copyright ©1997-2003, Roger Harris. All rights reserved.