Hmmm..I'm getting conflicting info from the list...

One said to escape the characters... \.\$, (don't
know why the comma wasn't escaped...perhaps
it isn't "special"...(now it's sad because it's not "special"... ;o)

Another said they don't need to be escaped...

You're coming down on the escape side...

would it be REReplace(string, "[\.\$,]", "", "All")
or
would it be REReplace(string, "[\.\$\,]", "", "All")

?

Just for the record, I implemented it without the
escapes yesterday and it seems to be performing correctly...

Rick

> -----Original Message-----
> From: Andy Matthews [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, March 08, 2006 10:09 AM
> To: CF-Talk
> Subject: RE: How do I write a Regex for this?
>
>
> Rick...
>
> The period and dollar sign are called meta-characters. They allow really
> cool stuff to happen using regex, but to treat them as
> "themselves" you have
> to escape them with a backslash.
>
> The period matches ANY one character.
>
> The dollar sign anchors a match at the end of a string.
>
> string = abc
> REReplace (string , ".$", "", "all")
>
> would replace "c"
>
> I'll go a little further and say these other meta-characters are also VERY
> useful.
>
> [] = a character "set".
>       [0-9] = any number
>       [a-z] = any lowercase letter
>       [abc123] = the letters a,b,c and the numbers 1,2,3
>
> * = as many as are there.
>       .* would replace EVERY character in a string
> + = matches one or more characters
>       string = abc123
>       REReplace (string , ".+", "", "all")
>       replaces the entire string
> ? = matches 0 or 1
>       string = abc123
>       REReplace (string , "[0-9]?$", "", "all") | replaces 3
>
> ^ = anchors at the beginning of a string
>       REReplace (string , "^[0-9]$", "", "all") | replaces nothing
>



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:234611
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to