I ended up using Replace to change
../geos/displayCountryData.cfm?countryCode=AS to ../geos/AS. Then I used
REMatch(../geos/[A-Z]{2},...) to find all occurrences of this resulting
pattern. I then processed each match in the array REMatch returned with
Replace(DBText, REMatchArrayEntry,
Hi All,
I'm trying to find a way of using regular expressions to locate and replace
text. My application reads in some text containing links from a DB: e.g.
../folderName/someCFMFile.cfm?code=AB. I want to change all occurrences of
this to ../folderName/AB.html. Note that code can be any
This is untested, but should be close.
REReplace(string, [a-zA-Z0-9_-]+\.cfm\?code=([A-Z]{2}), \1.html, all)
find zero or more a-zA-Z0-9_-, then .cfm?code=, then any two A-Z and
replace the whole thing with thos upper case letters plus .html. If
someCFMFile.cfm is static, you can replace that
12, 2009 11:20 AM
To: cf-talk
Subject: Help With Regular Expressions
Hi All,
I'm trying to find a way of using regular expressions to locate and replace
text. My application reads in some text containing links from a DB: e.g.
../folderName/someCFMFile.cfm?code=AB. I want to change all
It is saying any character in the set that is not a-z or 0-9.
NOTE: He's testing that a bad character is found (instead of that only good
characters are found) which should be slightly faster since it can return false
at the first bad character found. Make not of the ReFind**NOCASE** :) That
Mark Fuqua wrote:
Trying to wrap my head around this and get it to work with the framework I'm
using...what does this say, in words...
[^a-z0-9]
does it say characters other than a-z, 0-9 or only characters a-z, o-9?
thanks
The ^ character is the 'NOT' operand of regex when used inside of a
expressions
cfif REFindNoCase([^a-z0-9], yourString)
Bad chars
/cfif
Adrian
-Original Message-
From: Mark Fuqua
Sent: 04 February 2008 16:30
To: CF-Talk
Subject: Help with Regular expressions
I need to check and see that a form field has no special characters or
spaces, only
, February 04, 2008 11:32 AM
To: CF-Talk
Subject: RE: Help with Regular expressions
cfif REFindNoCase([^a-z0-9], yourString)
Bad chars
/cfif
Adrian
-Original Message-
From: Mark Fuqua
Sent: 04 February 2008 16:30
To: CF-Talk
Subject: Help with Regular expressions
I need to check
I need to check and see that a form field has no special characters or
spaces, only 0-9 and a-z. I'm guessing a regular expression could do that.?
I need a regular expression to do a pattern matching test.if it has anything
other than a-z or 0-9 it should fail.
Thanks
Mark Fuqua
cfif REFindNoCase([^a-z0-9], yourString)
Bad chars
/cfif
Adrian
-Original Message-
From: Mark Fuqua
Sent: 04 February 2008 16:30
To: CF-Talk
Subject: Help with Regular expressions
I need to check and see that a form field has no special characters or
spaces, only 0-9 and a-z
Hello Everybody,
I've tried hard to find a solution to my problem but
have had no luck.
I am pulling the data from the 'comments' column in a
database table. The data in the comments column looks
like this.
*** User1 10/28/2003 2:53:52 ***
THIS IS A TEST
*** User 2 04/06/200313:41:47 ***
Why regex rather than just Replace() or ListGetAt()?
- Original Message -
From: cf coder
To: CF-Talk
Sent: Friday, May 14, 2004 11:15 AM
Subject: help with regular expressions!
Hello Everybody,
I've tried hard to find a solution to my problem but
have had no luck.
I am pulling
I don't think his string has delimiters.
-Original Message-
From: Dave Francis [mailto:[EMAIL PROTECTED]
Sent: Friday, May 14, 2004 10:34 AM
To: CF-Talk
Subject: Re: help with regular expressions!
Why regex rather than just Replace() or ListGetAt()?
- Original Message -
From: cf
delimiters.
-Original Message-
From: Dave Francis [mailto:[EMAIL PROTECTED]
Sent: Friday, May 14, 2004 10:34 AM
To: CF-Talk
Subject: Re: help with regular expressions!
Why regex rather than just Replace() or ListGetAt()?
- Original Message -
From: cf coder
To: CF-Talk
Sent: Friday
every string has delimiters
- Original Message -
From: [EMAIL PROTECTED]
To: CF-Talk
Sent: Friday, May 14, 2004 11:39 AM
Subject: RE: help with regular expressions!
I don't think his string has delimiters.
-Original Message-
From: Dave Francis [mailto:[EMAIL PROTECTED]
Sent
First a couple of observations:
If it were me, all of those fields would be in separate fields in the database.
Then there would be no need to do what you are doing.
However, it that's not an option, change the way you are posting the data so it's a list, and parse it out that way, using a
15:58:15/span
I don't think his string has delimiters.
-Original Message-
From: Dave Francis [mailto:[EMAIL PROTECTED]
Sent: Friday, May 14, 2004 10:34 AM
To: CF-Talk
Subject: Re: help with regular expressions!
Why regex rather than just Replace() or ListGetAt
I want to use a regular _expression_ that
finds any commas that are between quotation marks and
either escapes them or replaces them
Here is an my string.
2003/09/09 14:49:05, TestUser1,
/Doc/News/Budgeting,Forecasting Reporting.doc,
OK
As you can see /Doc/News/Budgeting,Forecasting
The problem is in defining between quotation marks because technically
in testuser1,testuser2 the comma *is* between quotation marks.I
can see how you could loop over the string and keep the pairs consistent
that way, but I can't off the top of my head think of a way to do it
with a single
Try this:
cfset string = '11/12/2003, bob, this is a ,comma,list,end'
cfscript
string = string ,;
first = find('', string);
second = find('', string, first + 1);
while(first and second)
{
string = left(string, first) replace(mid(string, first + 1,
second-first), ',', '~', all)
You could run it on any line that has too many list elements.That is,
if listlen(5) then run the script on it (define it as a UDF and call it).
HTH.
--Ben
ColdFusion Programmer wrote:
Thanks Ben, the problem with that script is that because I'm reading a
log file with 300 plus rows of
21 matches
Mail list logo