If you'd like you can use the underlying java implementation of replaceAll.
Cfset str = ~{Test Information2/a/li~{Test Information/a/li~{Test
Information4/a/li~{Test Information/a/li /
cfdump var=#str.replaceAll( ([a-zA-Z0-9])/a/li, $1}~/a/li )#
/
Should show: ~{Test Information2}~/a/li~{Test
This might be more of what you are looking for. It captures special
characters as well and should fit more in line to what you want.
Cfset str = ~{Test Infor$%mation2$/a/li~{Test
Information/a/li~{Test Information4/a/li~{Test Information/a/li
/
cfdump var=#str.replaceAll( (~\{.*?)/a/li,
Give this a go:
cfset Result = InputText.replaceAll
( '~\{(?:(?!/a).)+(?!\}~)(?=/a/li)'
, '$0}~'
) /
It uses the java replaceAll regex function so that it can do the negative
lookbehind to ensure existing correct items are not changed, meaning it can be
run
Sent: Tuesday, June 14, 2011 12:16 PM
Subject: Re: Regular Expression Help
Give this a go:
cfset Result = InputText.replaceAll
( '~\{(?:(?!/a).)+(?!\}~)(?=/a/li)'
, '$0}~'
) /
It uses the java replaceAll regex function so that it can do the negative
lookbehind
I think you want something like this:
cfif REFindnocase(([\s\]#badword#[\s\]),skills)
You may want to expand it to non-alphanumeric wrappers, though, to catch
punctuation: he gave her a kiss.
cfif REFindnocase(([\W]#badword#[\W]),skills)
which is the same as
cfif
Not sure what I am doing wrong but this is not working.
I have the string kissess are goodbrkissbrthe girlfriend
Kiss is a badword, and this regexp is not picking it up.
Please advise and thanks for your help.
Matt
I think you want something like this:
cfif
Hm, that should work, certainly. Did you try that 3rd option?
cfif REFindnocase(([^a-zA-Z0-9_]#badword#[^a-zA-Z0-9_]),skills)
That should find any use of the word 'kiss' when it's surrounded by any
non-alpha characters. Sadly I don't have access to my CF environment right at
the moment,
Forgot about Ryan Swanson's slick little tool. It certainly validates and
picks up the middle 'kiss' in his validator, using either '\W' or '^a-zA-Z0-9_'
as the filter:
http://ryanswanson.com/regexp/#start
~|
Adobe®
Figured out the issue, this works great.
Thank you, thank you, thank you
~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
I just found an issue with this regexp
cfif REFindnocase(([^a-zA-Z0-9_]#badword#[^a-zA-Z0-9_]),clean_skills)
this works great if it is not the first word or only word in the string.
what do I need to do to update the regexp to pick up the bad word it is the
first last or only word in the
Typo: cfif REFindnocase(((^|\W)#badword#(\W|$)),clean_skills)
On Fri, Oct 31, 2008 at 1:09 PM, Sonny Savage [EMAIL PROTECTED] wrote:
cfif REFindnocase(((^|\W)#badword#(\W|$),clean_skills)
On Fri, Oct 31, 2008 at 1:04 PM, Matthew Friedman [EMAIL PROTECTED]wrote:
I just found an issue with
Good call. Try this, seems to work in initial testing:
cfif REFindnocase(((^|[^a-zA-Z0-9_])#badword#([^a-zA-Z0-9_]|$)),
clean_skills)
I just found an issue with this regexp
cfif REFindnocase(([^a-zA-Z0-9_]#badword#[^a-zA-Z0-9_]),
clean_skills)
this works great if it is not the first
cfif REFindnocase(((^|\W)#badword#(\W|$),clean_skills)
On Fri, Oct 31, 2008 at 1:04 PM, Matthew Friedman [EMAIL PROTECTED] wrote:
I just found an issue with this regexp
cfif REFindnocase(([^a-zA-Z0-9_]#badword#[^a-zA-Z0-9_]),clean_skills)
this works great if it is not the first word or
I am working on a variable mask version as I have time. This one will
atleast mask the domain for now.
Eric
On 2/20/07, Eric Haskins [EMAIL PROTECTED] wrote:
cfset email = ReReplaceNocase(email,
([a-zA-Z0-9_\-\.]+)@((([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3}),
[EMAIL PROTECTED])/
Try
cfset variables.domainlen = Len(ReReplaceNocase(attributes.email,
([a-zA-Z0-9_\-\.]+)@((([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3}),
\2)) - 1
cfset variables.mask =
cfloop from=1 to=#variables.domainlen# index=i
cfset variables.mask = variables.mask *
/cfloop
cfset variables.email =
cfset email = ReReplaceNocase(email,
([a-zA-Z0-9_\-\.]+)@((([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3}),
[EMAIL PROTECTED])/
Try this one
Eric
On 2/20/07, K Simanonok [EMAIL PROTECTED] wrote:
I would like to use a regular expression to camouflage email addresses in
a forum I'm building.
Offhand, I think your best bet is to use a regex to identify everything
from the @ to the TLD, then use the len returned by refind to do a
replace of it. There are a number of really good regexes for
finding/dissecting emails out there. CFLib.org is a good place to start.
--Ben Doom
K
Not really sure what exactly you are looking to do, but the regular
expression pattern for numbers under 100 with 7 decimals would be:
\d{2}(\.\d{1,7})?
This makes the decimal optional (with 1 to 7 decimal places). Of course,
this does not protect AGAINST numbers over one hundred. For that you
Ben Nadel wrote:
Not really sure what exactly you are looking to do, but the regular
expression pattern for numbers under 100 with 7 decimals would be:
\d{2}(\.\d{1,7})?
I'd anchor it, assuming that this is supposed to be the whole string:
^\d{2}(\.\d{1,7})?$
--Ben Doom
: Regular Expression Help
Ben Nadel wrote:
Not really sure what exactly you are looking to do, but the regular
expression pattern for numbers under 100 with 7 decimals would be:
\d{2}(\.\d{1,7})?
I'd anchor it, assuming that this is supposed to be the whole string:
^\d{2}(\.\d{1,7})?$
--Ben
That would not match 0 through 9.999 unless they were formatted into 2
digit numbers like 00, 01, etc... 09.999 It also wouldnt match anything
between 1 and 0 like .999 unless it was formatted like 00.999
Try this one: ^\d{0,2}(\.\d{1,7})?$
I dont know what you are using it for
Dave,
While you probably don't need this anymore, I thought I would post it up
here as your question inspired my blog post:
http://www.bennadel.com/blog/487-Using-Verbose-Regular-Expressions-To-Ex
plain-Url-Auto-Linking-In-ColdFusion.htm
[ OR http://bennadel.com/index.cfm?dax=blog:486.view ]
:31 PM
To: CF-Talk
Subject: Re: Regular Expression Help
Dave how did it turn out??
~Eric
~|
Upgrade to Adobe ColdFusion MX7
Experience Flex 2 MX7 integration create powerful cross-platform RIAs
http:http
This page might get you pointed in the right direction.
http://foad.org/~abigail/Perl/url2.html
-Original Message-
From: Dave Phillips [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 23, 2007 8:36 AM
To: CF-Talk
Subject: Regular Expression Help
Hi,
RegExp's are not my forte and
This one might be better:
http://www.manamplified.org/archives/000318.html
-Original Message-
From: Andy Matthews [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 23, 2007 9:50 AM
To: CF-Talk
Subject: RE: Regular Expression Help
This page might get you pointed in the right
Thanks, I'm working on something with that now, but does anyone know if there
is a function or tag out there someone has already written that does this? It
seems that I should not be the first person who needs to feed a function a body
of text and get back a list of the URL's in that text.
I think I have a solution, but if a few of you could review and see if it can
be any faster or more efficient (or if I'm missing something) I'd appreciate
it. To find the end of the URL I'm looking for a single quote, double quote or
space.
function extractURLs(inputString) {
var
?
www.bennadel.com/ask-ben/
-Original Message-
From: Dave Phillips [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 23, 2007 9:55 AM
To: CF-Talk
Subject: Re: Regular Expression Help
Thanks, I'm working on something with that now, but does anyone know if
there is a function or tag out there someone
, 2007 10:25 AM
To: CF-Talk
Subject: Re: Regular Expression Help (Solution?)
I think I have a solution, but if a few of you could review and see if
it can be any faster or more efficient (or if I'm missing something) I'd
appreciate it. To find the end of the URL I'm looking for a single
quote
Hi,
The RegExp below is giving me more than I want. It is returning things that I
don't want:
mailto:
urn:schemas-microsoft-com:office:office
and others. I want to chnage it to only return url's starting with http: or
https:. Here's what I currently have:
When I test it tells me not enough (
I am troubleshooting it now out sick today but list draws me back
everytime lol
Eric
On 1/23/07, Dave Phillips [EMAIL PROTECTED] wrote:
Hi,
The RegExp below is giving me more than I want. It is returning things
that I don't want:
mailto:
Try this one
https?:)\/\/)|(www\.|ftp\.))[-[:alnum:]\?%,\.\/##!@:=\+~_]+[A-Za-z0-9\/
])
-Original Message-
From: Dave Phillips [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 23, 2007 2:03 PM
To: CF-Talk
Subject: Re: Regular Expression Help
Hi,
The RegExp below is giving me
(?:href=|href=|href=')((?:http|https)://(.+))(?:|'|)
Does this help at all??? This will find all http or https links??
Eric
On 1/23/07, Eric Haskins [EMAIL PROTECTED] wrote:
When I test it tells me not enough (
I am troubleshooting it now out sick today but list draws me back
, January 23, 2007 2:03 PM
To: CF-Talk
Subject: Re: Regular Expression Help
Hi,
The RegExp below is giving me more than I want. It is returning things that
I don't want:
mailto:
urn:schemas-microsoft-com:office:office
and others. I want to chnage it to only return url's starting with http
Dave how did it turn out??
~Eric
~|
Upgrade to Adobe ColdFusion MX7
Experience Flex 2 MX7 integration create powerful cross-platform RIAs
-Original Message-
From: John Munyan [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 10, 2005 3:03 AM
To: CF-Talk
Subject: Regular expression help
Hi, I have an url such as
http://www.blah.com/something/somethingelse/default.cfm stored in a
database. I wish to use this
I found the fix guys!!! Amazing what a little Googling will do. :P
Rey...
Rey Bango wrote:
Guys,
I have the following email check but it won't accept a .info email
address. I'm not a regular expression expert and was hoping someone
could help me out with this. How could I update the
REReplaceNoCase(text,'^.*input type=hidden name=BV_SessionID
value=([^]*).*$',\1)
Pascal
-Original Message-
From: Daniel Farmer [mailto:[EMAIL PROTECTED]
Sent: 05 November 2004 10:24
To: CF-Talk
Subject: Regular Expression Help
I'm searching a long string and looking for the
Thanks Pascal... but I am having problems implementing
cfset theval = #REFind('^.*input type=hidden name=BV_SessionID
value=([^]*).*$',\1,)#, cfhttp.filecontent, startpos )#
~|
Special thanks to the CF Community Suite Gold
-
From: Pascal Peters [mailto:[EMAIL PROTECTED]
Sent: 05 November 2004 10:43
To: CF-Talk
Subject: RE: Regular Expression Help
REReplaceNoCase(text,'^.*input type=hidden name=BV_SessionID
value=([^]*).*$',\1)
Pascal
-Original Message-
From: Daniel Farmer [mailto:[EMAIL PROTECTED
cfset theval = REReplaceNoCase(cfhttp.filecontent,'^.*input
type=hidden name=BV_SessionID value=([^]*).*$',\1)
Pascal
-Original Message-
From: Daniel Farmer [mailto:[EMAIL PROTECTED]
Sent: 05 November 2004 11:10
To: CF-Talk
Subject: Re: Regular Expression Help
Thanks Pascal
November 2004 12:11
To: CF-Talk
Subject: RE: Regular Expression Help
Pascal,
Would it be possible for you to explain a bit more about what each
part
of
the RegEx is doing? I'm trying to do something similar and I'm having
no
end
of trouble getting the RegEx right. MM documentation
If this is the actual code you are using, you are creating an infinite
loop because you always start looking at the start position 1 in your
REFind. It will keep matching the first {}.
It really depends what you are trying to grab. If you are trying to get
only the inner parentheses it is not too
On CFMX
stTmp = REFindNoCase('msg:(.*?);',str,1,true);
if(stTmp.pos[1]){
message = Mid(str,stTmp.pos[2],stTmp.len[2]);
}
else {
message = ;
}
ON CF5
stTmp = REFindNoCase('msg:(([^]|[^;])*);',str,1,true);
if(stTmp.pos[1]){
message = Mid(str,stTmp.pos[2],stTmp.len[2]);
}
else {
message = ;
}
This should work.
cfset test = (msg:My Message Here; content:My Content Here;)
cfset temp = refindnocase(msg:([^;]*),test,1,yes)
cfloop from=1 to=#arraylen(temp.pos)# index=i
cfoutput#mid(test,temp.pos[i],temp.len[i])#br/cfoutput
/cfloop
--
Marlon Moyer, Sr. Internet Developer
American
cfscript
regexp = ##[[:space:]]*([0-9]{2-3});
stTmp = REFindNoCase(regexp,str,1,true);
if(stTmp.pos[1])
result = Mid(str,stTmp.pos[2],stTmp.len[2]);
else
result = ;
/cfscript
If you need to find all, you do it in a loop:
cfscript
regexp = ##[[:space:]]*([0-9]{2-3});
results = ArrayNew(1);
How about this?
cfset result = reFind(##[[:space:]]*([[:digit:]]+), myString, 1, true)
cfif result.pos[1]
cfoutput#mid(myString, result.pos[2],
result.len[2])#/cfoutput
/cfif
-Original Message-
From: Andy Ousterhout [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 17 February 2004 11:05 a.m.
What version of CF?--Ben the RegEx Ninja Doomkelly wrote:Ok I suck at reg expressions.Basically I have some data and within the data there is some stuff I want to remove.Example text text a href="" href="http://www.blah.comblah">http://www.blah.comblah http://www.blah.comblah blah blah blah/a
Ok basically I want to remove everything from a href through /a althoughit will be different on every line.This is tipically the situation why I developed CF_REextract (seehttp://www.contentbox.com/claude/customtags/tagstore.cfm?p=hf(see specs and examples)The tag will find all occurences, and
ReReplaceNoCase(string,[[:punct:]],_,ALL)
Joshua Miller
Head Programmer / IT Manager
Garrison Enterprises Inc.
www.garrisonenterprises.net
[EMAIL PROTECTED]
(704) 569-9044 ext. 254
*
Any views expressed in
Oh, forgot the space use [[:punct:]]||[[:space:]] as the RegEX
Joshua Miller
Head Programmer / IT Manager
Garrison Enterprises Inc.
www.garrisonenterprises.net
[EMAIL PROTECTED]
(704) 569-9044 ext. 254
*
Something like
CFSET sNewString = REReplace(sOldString, [[:punct:][:space:]], ,
ALL)
HTH
-Original Message-
From: Jeff D. Chastain [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 6, 2002 17:31
To: CF-Talk
Subject: Regular Expression Help
I am trying to use a regular expression to
It's as simple as:
cfset str =
reReplace(!@##\$%\^\*()-+={[}]|\\:;',\.\?/,_,all)
Notice I had to escape out the # and for CF and a few character that
regex use like . and *. It's possible I may have missed one though.
===
That was what I was looking for, I just had not found it yet.
Thanks
-Original Message-
From: Joshua Miller [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 06, 2002 11:42 AM
To: CF-Talk
Subject: RE: Regular Expression Help
ReReplaceNoCase(string,[[:punct:]],_,ALL)
Joshua Miller
: Friday, December 06, 2002 11:43 AM
To: CF-Talk
Subject: RE: Regular Expression Help
Oh, forgot the space use [[:punct:]]||[[:space:]] as the RegEX
Joshua Miller
Head Programmer / IT Manager
Garrison Enterprises Inc.
www.garrisonenterprises.net [EMAIL PROTECTED]
(704) 569-9044 ext
How do you not replace a non-existent space before and after the string?
Everything else works great.
Thanks
-Original Message-
From: Joshua Miller [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 06, 2002 11:43 AM
To: CF-Talk
Subject: RE: Regular Expression Help
Oh, forgot the space
I think you accidentally doubled the pipes between the punct and space. It
should be:
[[:punct:]]|[[:space:]]
Thanks,
Doug
-Original Message-
From: Joshua Miller [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 06, 2002 11:43 AM
To: CF-Talk
Subject: RE: Regular Expression Help
Oh
]]
Sent: Friday, December 06, 2002 11:43 AM
To: CF-Talk
Subject: RE: Regular Expression Help
Oh, forgot the space use [[:punct:]]||[[:space:]] as the RegEX
Joshua Miller
Head Programmer / IT Manager
Garrison Enterprises Inc.
www.garrisonenterprises.net [EMAIL PROTECTED]
(704) 569-9044
My ally is the Force, and a powerful ally it is. - Yoda
-Original Message-
From: Jeff D. Chastain [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 06, 2002 11:53 AM
To: CF-Talk
Subject: RE: Regular Expression Help
How do you not replace a non-existent space before and after
]
*
-Original Message-
From: Rob Rohan [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 06, 2002 12:54 PM
To: CF-Talk
Subject: RE: Regular Expression Help
lastly, you could think backwards [^A-Za-z0-9]
Rob
http
' returns '_some_phrase_' instead
of 'some_phrase' which is what I was looking for.
Thanks
-Original Message-
From: Raymond Camden [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 06, 2002 11:54 AM
To: CF-Talk
Subject: RE: Regular Expression Help
What is a non-existent space? How could
Yep, this is probably the safest bet and produces the expected result.
Thanks
-Original Message-
From: Rob Rohan [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 06, 2002 11:54 AM
To: CF-Talk
Subject: RE: Regular Expression Help
lastly, you could think backwards [^A-Za-z0-9]
Rob
and
advise us by return e-mail to [EMAIL PROTECTED]
*
-Original Message-
From: Jeff D. Chastain [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 06, 2002 1:03 PM
To: CF-Talk
Subject: RE: Regular Expression Help
, the first method works just fine and is probably safer.
-Original Message-
From: Joshua Miller [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 06, 2002 12:30 PM
To: CF-Talk
Subject: RE: Regular Expression Help
Did you TRIM the variable first? That may help ... Perhaps there's
whitespace
, Post to, or Join the list here for all your RegEx needs. :-)
--Ben Doom
Programmer General Lackey
Moonbow Software
: -Original Message-
: From: Joshua Miller [mailto:[EMAIL PROTECTED]]
: Sent: Friday, December 06, 2002 12:43 PM
: To: CF-Talk
: Subject: RE: Regular Expression
Mark,
I am fairly new to RegEx, but I can tell you we did this on our University's site when
I was in college.
We allowed the different departments to submit formatted text using an assortment of
HTML tags that we specified.
We used RegEx to do this, and did not notice a performace hit at all.
If you have a limited range of accepted tags then the following will probably be your
best bet.
1. find all of the tags you want to allow.
2. replace their brackets with some non-standard character (like a yen symbol).
3. remove all other tags that exist.
4. replace your yen with brackets
-Talk
Subject: Re: Regular Expression Help
On Sat, 2002-03-02 at 10:10, Jared Stark wrote:
Hello all. I am trying to write a simple search engine, and would
like
to replace certain commonly used prepositions from the search string
such as 'a','the','for', etc...
I have an array
On Sat, 2002-03-02 at 10:10, Jared Stark wrote:
Hello all I am trying to write a simple search engine, and would like
to replace certain commonly used prepositions from the search string
such as 'a','the','for', etc
I have an array of the prepositions that I would like to remove, however
Sleeman [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Saturday, March 02, 2002 4:28 AM
Subject: Re: Regular Expression Help
On Sat, 2002-03-02 at 10:10, Jared Stark wrote:
Hello all. I am trying to write a simple search engine, and would
like
to replace certain commonly used prepositions
Going from limited memory of the subject here, but try something like this:
[\w the|a|..] (the 'the|a|..' part would be your preposition
list...)
I think the \w means you are looking for whole words. Or it might be \W...
Hope that helps some...
Shawn Grover
-Original
Or you could use ListReplace with as the delimiter -- as long as you
force everything lower case first.
- Original Message -
From: Jared Stark [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Saturday, March 02, 2002 10:10 AM
Subject: Regular Expression Help
Hello all. I am
I have a field that will be populated with a first name and a last name,
what I want to do is make sure that the first letter of the first last
name is uppercase and that all others are lower case. Could someone help
in a reg expression that will do this?
I'm having problems finding ways
try
CFIF REFind(^[A-Z][a-z]+, VARIABLENAME)
it's capitalized!
/CFIF
christopher olive, cto, vp of web development
cresco technologies, inc
410.825.0383
http://www.crescotech.com
-Original Message-
From: Douglas Brown [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 16, 2002 1:46 PM
, 2002 11:20 AM
Subject: RE: Regular expression help
try
CFIF REFind(^[A-Z][a-z]+, VARIABLENAME)
it's capitalized!
/CFIF
christopher olive, cto, vp of web development
cresco technologies, inc
410.825.0383
http://www.crescotech.com
-Original Message-
From: Douglas Brown
: Wednesday, January 16, 2002 11:20 AM
Subject: RE: Regular expression help
try
CFIF REFind(^[A-Z][a-z]+, VARIABLENAME)
it's capitalized!
/CFIF
christopher olive, cto, vp of web development
cresco technologies, inc
410.825.0383
http://www.crescotech.com
-Original Message-
From
this to be a coincidence.
Doug Brown
- Original Message -
From: Douglas Brown [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Wednesday, January 16, 2002 11:43 AM
Subject: Re: Regular expression help
That definately will not do it.
There are two major products that come out
: Wednesday, January 16, 2002 3:00 PM
To: CF-Talk
Subject: Re: Regular expression help
All refind does is find the starting position of a string.
IE:
CFSET test = REFind(^[A-Z][a-z]+, hello world)
CFOUTPUT
#test#
/CFOUTPUT
returns 0
I need it to change hello world to Hello World
There are two
]
-
Macromedia Associate Partner
www.macromedia.com
- Original Message -
From: Douglas Brown [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Wednesday, January 16, 2002 12:00 PM
Subject: Re: Regular expression help
All refind does is find
opinion. :)
Of course, RegExp has its uses. In your case, it isn't the most optimal
solution.
James.
-Original Message-
From: Douglas Brown [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 16, 2002 12:00 PM
To: CF-Talk
Subject: Re: Regular expression help
All refind does is find
Here's a UDF I may not be the most eloquent but it does work.
I used it to do tile casing. why my string is title ;o)
CFscript
//Changes a String to Title case
Function TitleCase(title){
title = trim(title);
//Caps first letter of string and
There was a /CFSCRIPT at the bottom, must have gotten cut off.
-Original Message-
From: Bruce, Rodney (Contractor) [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 16, 2002 1:05 PM
To: CF-Talk
Subject: RE: Regular expression help
Here's a UDF I may not be the most eloquent
Douglas Brown wrote:
I have a field that will be populated with a first name and a last name,
what I want to do is make sure that the first letter of the first last
name is uppercase and that all others are lower case. Could someone help
in a reg expression that will do this?
It is
, January 16, 2002 11:57 AM
Subject: RE: Regular expression help
Use the UDF: capFirstTitle()
http://www.cflib.org/udf.cfm?ID=116
For your purpose, CF RegExp won't do it as well as what Ed Hodder
implemented with his UDF.
But, FYI, REFind() and REFindNoCase() can return subexpressions.
Example
string = string.replace(/HEAD[^]*[.\n]*\/HEAD/gi,'');
Pascal Peters
Macromedia Certified Instructor
Certified ColdFusion (5.0) Advanced Developer
Certified Web Developer
LR Technologies, Belgium
Tel +32 2 639 68 70
Fax +32 2 639 68 99
Email [EMAIL PROTECTED]
Web www.lrt.be
You could just find the first head, store the position, find the next head,
store the position, and then just use mid(string,pos+6,pos-1) to strip the
middle out
maybe there is a more efficient way
Brook
At 11:32 PM 08/11/01 +, you wrote:
The code I'm doing now is actually in
Try using
cfset string=rereplace(string,(head)[[:print:]]*(/head),,all)
That should find anything with a beginning of head and an ending of
/head and strip them out and any printable character in between with an
empty string. I'm not sitting at a coldfusion enabled server, so I can't
verify,
Dain, thank you very much. Is it safe to assume then that
anything else i
want to search for can be added by placing the definition
inside another
pair of brackets?
Yeah, square brackets define a class to match against, and clasess are or'ed
together.
[^ ] would match everything that
PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Friday, July 27, 2001 1:39 AM
Subject: Re: Regular Expression Help
Dain, thank you very much. Is it safe to assume then that anything else i
want to search for can be added by placing the definition inside another
pair of brackets?
REFindNoCase
:
nc.rr.comSubject: Re: Regular Expression Help
I find that:
[0-9]
is clearer and easier to type than:
[:digit:]
of course, I'd rather have:
\d
I do very well without ever using the posix-style.
Dick
At 8:56 AM -0400 7/27/01, [EMAIL PROTECTED] wrote:
Being a Perl programmer also, this is one of the things that really
John,
You almost had it (too many brackets):
cfif REFindNoCase([[:Alpha:][:Punct:]], myString)
Alpha characters or punctuation were found.
cfelse
No alpha characters or punctuation found.
/cfif
If you need to get the position of the first occurance of these characters,
use subexpressions:
PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Subject: Re: Regular Expression Help
Date: Thu, 26 Jul 2001 21:02:45 -0400
John,
You almost had it (too many brackets):
cfif REFindNoCase([[:Alpha:][:Punct:]], myString)
Alpha characters or punctuation were found.
cfelse
OT: are there any statistics on how many developers regexp has made bald?
~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives:
Re: use of regular expressions for parsing html
One can reliably use regular expressions to parse html if it is
html that you have direct and full editorial control over.
That is, if you hand edit the html, AND you can keep all your
requirements in mind, then you can use with some success
This works.
CFSET theString = "meta name=""pubdate"" content=""Fri, 23 Mar 2001
07:00:00 GMT"""
CFSET st = reFindNoCase("(content="")(.*)(GMT"")",theString,1,"TRUE")
CFOUTPUT#mid(theString,st.pos[3],st.len[3])#/CFOUTPUT
The two pieces are:
1) Creating the regularExpression
2) understanding
Mallory,
Try this:
cfset newVar=REFind(varWithHTML,'meta name="pubdate"[^]+')
That should return the string;
meta name="pubdate" content="[some date]"
Which you can then extract the date from.
Good luck!
Douglas Malcolm
-Original Message-
From: Mallory Woods [mailto:[EMAIL
This should work if you want the GMT included:
REFINDNOCASE("meta name=""pubdate"" content=""([a-zA-Z0-9,: ]+[^"])""",
YourStringNameGoesHere)
This should work if you don't want GMT:
REFINDNOCASE("meta name=""pubdate"" content=""([a-zA-Z0-9,: ]+[^GMT"])""",
YourStringNameGoesHere)
Remember CF
Leaves table tags in:
cfset
VariableWithTags=#REReplaceNoCase(VariableWithTags,'table([[:alpha:]]|[[:s
pace:]]|[[:punct:]])+/table','table/table')#
Removes table tags:
cfset
VariableWithTags=#REReplaceNoCase(VariableWithTags,'table([[:alpha:]]|[[:s
pace:]]|[[:punct:]])+/table','')#
Note
On Fri, 23 Feb 2001 10:33:10 +1300, in cf-talk you wrote:
Firstly I'd like to mention that doing this is playing with fire. ;)
Yeah, of course it is ;)
Secondly, I'd suggest three replaces:
1. Replace application.cfm with an easily recognisable other string without
application in the name.
2.
1 - 100 of 111 matches
Mail list logo