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
<!----------------//------
andy matthews
web developer
ICGLink, Inc.
[EMAIL PROTECTED]
615.370.1530 x737
--------------//--------->
-----Original Message-----
From: Rick Faircloth [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 07, 2006 6:05 PM
To: CF-Talk
Subject: RE: How do I write a Regex for this?
Thanks, Claude...that seems to have done just what I needed.
What do the \'s do? And the + sign?
Rick
> -----Original Message-----
> From: Claude Schneegans [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 07, 2006 6:40 PM
> To: CF-Talk
> Subject: Re: How do I write a Regex for this?
>
>
> >>How would I write that in a Regex?
>
> Try this:
>
> REReplace (myString, "[\.\$,]+", "", "all")
>
> --
> _______________________________________
> REUSE CODE! Use custom tags;
> See http://www.contentbox.com/claude/customtags/tagstore.cfm
> (Please send any spam to this address: [EMAIL PROTECTED])
> Thanks.
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:234606
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=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54