Thanks guys for all your help its been a good regex learning
experience as usual for me :)
@Ben yours is the one i've gone with thank for the comments and explanation
Andy J
On Nov 7, 2007 8:24 PM, Ben Doom [EMAIL PROTECTED] wrote:
A handful of comments:
Backreferencing a single, static
Hi
I'm trying to do a look through as string to find usernames and add
a tags around them ala Twitter.
The regex I think is fine but when I use reReplace 's back reference
I'm not getting the result I thought I would of. Heres the code. Can
anyone see anything obvious?
Cheers, Andy
!---
A handful of comments:
Backreferencing a single, static character is silly. It just wastes
memory and processor time. You're throwing it away, anyway.
{1} is useless. It means one of. Which would just be the thing by
itself.
Second, {1,} is more commonly written +. Also, you are saying
http://acoderslife.com
-Original Message-
From: Andy Jarrett [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 07, 2007 2:04 PM
To: CF-Talk
Subject: Wierd regex problem (isn't it always)
Hi
I'm trying to do a look through as string to find usernames and add
a tags around them ala
Andy,
I'm not a regex ninja, like some, but I think what you're looking for
is this. Escape the space character (using ^) so that any
backreferences stop at the space character.
cfset reg = @([a-zA-Z0-9][^ ]+) /
Then you can use the first backreference:
cfset usernamePos = reReplace(str,
I have a regex brain teaser.. Well at least its teasing my brain.
How do I lop off the end of a string up to and including the first (
for example:
blah blah blah blah (2) (12345678) would become
blah blah blah blah (2)
Thanks!
Jeff
do you just not want to use string manipulation?
-Original Message-
From: J W [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 07, 2005 10:13 AM
To: CF-Talk
Subject: Regex problem.
I have a regex brain teaser.. Well at least its teasing my brain.
How do I lop off the end of a string
Try something like:
rereplace(string, (.*)\(.*?\), \1);
Not tested, YMMV, and probably not very efficient. I'd probably look
into more conventional string manipulation to take care of it. Like by
finding all the open parens, and nixing everything from the last one on.
--Ben
J W wrote:
I
I know that I can do this with string manipulation but I thought that the
regex would be more compact and faster. Am I assuming wrong?
Jeff
On 12/7/05, Benjamin Paige [EMAIL PROTECTED] wrote:
do you just not want to use string manipulation?
Regex is frequently more compact. Regex is rarely faster if there's a
fairly simple way to do it using standard string manipulation. As much
as I love regex, I'll use a couple of standard string manipulation
functions instead if possible.
--Ben
J W wrote:
I know that I can do this with
Subject: Re: Regex problem.
I know that I can do this with string manipulation but I thought that the
regex would be more compact and faster. Am I assuming wrong?
Jeff
On 12/7/05, Benjamin Paige [EMAIL PROTECTED] wrote:
do you just not want to use string manipulation
for Pedro
-Original Message-
From: J W [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 07, 2005 10:13 AM
To: CF-Talk
Subject: Regex problem.
I have a regex brain teaser.. Well at least its teasing my brain.
How do I lop off the end of a string up to and including the first (
for example
Good call. Better than mine. I don't think you need the parens
wrapping the literal parens, though.
--Ben
Ben Nadel wrote:
REReplace(strInput, (\([0-9]+\))$, , ONE)
Not tested removes ONE instance of the string ([:digit:]) that ENDS the
string
Wouldn't that replace the (2) as well?
-Original Message-
From: Ben Doom [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 07, 2005 11:28 AM
To: CF-Talk
Subject: Re: Regex problem.
Good call. Better than mine. I don't think you need the parens
wrapping the literal parens, though
Developer
Nylon Technology
6 West 14th Street
New York, NY 10011
212.691.1134
212.691.3477 fax
www.nylontechnology.com
Vote for Pedro
-Original Message-
From: Benjamin Paige [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 07, 2005 11:31 AM
To: CF-Talk
Subject: RE: Regex problem.
Wouldn't
Hi all, I have to need to do the following;
Change all instances of
cfprocparam type=IN
value=#whatever#
cfsqltype=CF_SQL_WHATEVER
[EMAIL PROTECTED]
to become
cfprocparam type=IN
value=#whatever#
cfsqltype=CF_SQL_WHATEVER
In dreamweaver I am trying to use the find replace
Hi all, I have to need to do the following;
Change all instances of
cfprocparam type=IN
value=#whatever#
cfsqltype=CF_SQL_WHATEVER
[EMAIL PROTECTED]
to become
cfprocparam type=IN
value=#whatever#
cfsqltype=CF_SQL_WHATEVER
In dreamweaver I am trying to use the
No, I did not know this! I will have see if I can find where it is, thanks.
-Original Message-
From: Dave Watts [mailto:[EMAIL PROTECTED]
Sent: 25 November 2005 17:16
To: CF-Talk
Subject: RE: Yet another RegEx problem (But I nearly have it!)
Hi all, I have to need to do the following
No, I did not know this! I will have see if I can find where
it is, thanks.
Within Find Replace, choose Specific Tag and type in your tag, then
choose With Attribute and type in your attribute, then select Remove
Attribute and you should be all set.
Dave Watts, CTO, Fig Leaf Software
There's also CF RegEx at http://www.cfregex.com/ which is donationware
Andy
www.andyjarrett.co.uk
On Tue, 19 Oct 2004 19:23:16 -0400, dave [EMAIL PROTECTED] wrote:
http://www.regexbuddy.com/
so thats your secret charlie ;)
Hi there,
Out of the following string i am trying to return only the value in
the brackets user RegEx.
String = German (Luxembourg)
Is this possible in one Regex or does it have to be two?
Cheers
Andy J
www.andyjarrett.co.uk
.
To: CF-Talk
Subject: RegEx problem
Hi there,
Out of the following string i am trying to return only the
value in the brackets user RegEx.
String = German (Luxembourg)
Is this possible in one Regex or does it have to be two?
Cheers
Andy J
www.andyjarrett.co.uk
http://www.regexbuddy.com/
so thats your secret charlie ;)
~|
This list and all House of Fusion resources hosted by CFHosting.com. The place for
dependable ColdFusion Hosting.
set of brackets and nothing after the brackets.
You could also use listLast() with delimiters: ()
-Original Message-
From: Andy Jarrett [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 20 October 2004 12:04 p.m.
To: CF-Talk
Subject: RegEx problem
Hi there,
Out
Sorry I didn't get back to this.I left early yesterday -- injury time.
Anyway, Jeff already gave a good rundown of the classes available to
you, so I'll just give an example.
If you were searching for a simplified version of an email address like
[EMAIL PROTECTED] you might look for
I am trying to follow the regex example on page 82 of Ben Forta's regular Expressions in 10 Minutes book. The example does a simple replace using matched text and reReplaceNoCase().
cfset newString = [EMAIL PROTECTED]
#newString#br
cfset newString = reReplaceNoCase(newString, ([EMAIL PROTECTED]),
CF user \1 rather than $1. It should be covered in the end of the book on
language differences.
_
From: Josen Ruiseco [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 08, 2004 1:27 PM
To: CF-Talk
Subject: RegEx Problem Trying to Use Matched Text
I am trying to follow the regex example
In CF it is \1 : a href="">
Pascal
-Original Message-
From: Josen Ruiseco [mailto:[EMAIL PROTECTED]
Sent: 08 September 2004 19:27
To: CF-Talk
Subject: RegEx Problem Trying to Use Matched Text
I am trying to follow the regex example on page 82 of Ben Forta's
regular
Josen
In CF it is \1 : a href="">
Pascal
-Original Message-
From: Josen Ruiseco [mailto:[EMAIL PROTECTED]
Sent: 08 September 2004 19:27
To: CF-Talk
Subject: RegEx Problem Trying to Use Matched Text
I am trying to follow the regex example on page 82 of Ben Forta's
regular
CF5 doesn't support Perlish character classes (ie \w).
IIRC, you can use [[:alnum:]] to replace them.
BTW -- are you sure this is a direct copy from the book (aside from the
\1 vs $1 change)?It looks odd in several ways to me.
--Ben
Josen Ruiseco wrote:
I am using the following and I get
The regex used to find the email address and the replacement regex are from the book. The reReplaceNoCase and the output stuff is me.
I do not follow you with the [[:alnum:]] example. Please expound.
Josen
CF5 doesn't support Perlish character classes (ie \w).
IIRC, you can use [[:alnum:]] to
Heres a regex I use for email address finding. Maybe this can get you
moving in the right direction
cfset blah =
ReFindNoCase([EMAIL PROTECTED])
_
From: Ben Doom [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 08, 2004 3:58 PM
To: CF-Talk
Subject: Re: RegEx Problem Trying to Use
Josen,
ColdFusion uses the POSIX regular _expression_ character sets which are listed below:
alnum - the set of alpha-numeric characters
alpha - the set of alphabetic characters
blank - tab and space
cntrl - the control characters
digit - decimal digits
graph - all printable characters except
I don't want to be picky, but this won't work. He has a single quote too
in his character set!
-Original Message-
From: Dave Carabetta [mailto:[EMAIL PROTECTED]
Sent: donderdag 27 mei 2004 21:10
To: CF-Talk
Subject: RE: Regex problem
I have this _expression_ and it works great
That last quote within the brackets is a double quote, not a single quote
typed twice.
From: Pascal Peters [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Subject: RE: Regex problem
Date: Fri, 28 May 2004 09:39:54 +0200
I don't want to be picky, but this won't work
I know, but there is a single quote between ? and /
So for this to work, it should be
REReplaceNoCase(clean, '[^a-z0-9.!?''/\- ]', '', 'all')
-Original Message-
From: Dave Carabetta [mailto:[EMAIL PROTECTED]
Sent: vrijdag 28 mei 2004 16:01
To: CF-Talk
Subject: RE: Regex problem
Ah, good catch. I misread your initial statement.
From: Pascal Peters [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Subject: RE: Regex problem
Date: Fri, 28 May 2004 16:41:58 +0200
I know, but there is a single quote between ? and /
So for this to work, it should
I have this _expression_ and it works great.
REReplaceNoCase(clean, [^a-z0-9.!?'/\- ], , all)
Now I need to add a to it with out it causing an error. How do I do that?
Phillip B
[Todays Threads]
[This Message]
[Subscription]
[Fast Unsubscribe]
[User Settings]
Use two double quotes:
REReplaceNoCase(clean, [^a-z0-9.!?'/\- ], , all)
Phillip B wrote:
I have this _expression_ and it works great.
REReplaceNoCase(clean, [^a-z0-9.!?'/\- ], , all)
Now I need to add a to it with out it causing an error. How do I do that?
Phillip B
[Todays Threads]
I have this _expression_ and it works great.
REReplaceNoCase(clean, [^a-z0-9.!?'/\- ], , all)
Now I need to add a to it with out it causing an error. How do I do that?
Couldn't you just do this instead?
REReplaceNoCase(clean, '[^a-z0-9.!?'/\- ]', '', 'all')
(I just changed your surrounding
Thanks. :-]
Dain Anderson wrote:
Use two double quotes:
REReplaceNoCase(clean, [^a-z0-9.!?'/\- ], , all)
Phillip B wrote:
I have this _expression_ and it works great.
REReplaceNoCase(clean, [^a-z0-9.!?'/\- ], , all)
Now I need to add a to it with out it causing an error. How do I
. Otherwise you will add a
hyphen before each character.
Pascal
-Original Message-
From: DURETTE, STEVEN J (AIT) [mailto:[EMAIL PROTECTED]
Sent: maandag 6 oktober 2003 21:57
To: CF-Talk
Subject: OT:_javascript_ regex problem.
Hi all,
I have a little problem with some _javascript_ and a regex
, October 07, 2003 3:38 AM
To: CF-Talk
Subject: RE: _javascript_ regex problem.
script language=_javascript_
!--
function dispTest(){
var UpdprojStart = ; //five spaces.
UpdprojStart = UpdprojStart.replace(/\s+/ig, -);
alert(| + UpdprojStart + |);
UpdprojStart = 1 2 3 4 5; //a spacebefore each number
PROTECTED]
Sent: dinsdag 7 oktober 2003 12:31
To: CF-Talk
Subject: RE: _javascript_ regex problem.
Pascal,
Thanks, it's weird though, I copied a regex from the _javascript_
reference
and just replaced it with what came out of the vis regex editor.The
reference had the quotes!
Thanks again
Steve
Take the \s out of brackets.I suspect that's your problem.Also,
you're replacing with a dash, not a blank.
Or maybe I'm just tired.
--Ben
DURETTE, STEVEN J (AIT) wrote:
Hi all,
I have a little problem with some _javascript_ and a regex that I can't seem
to figure out.
I have the
Hi,
Don't ask me why, but you've got to pass your regular _expression_ between slashes, not quotes: try
UpdprojStart = UpdprojStart.replace(/[\s]*/, -);
One more stupidities of the pedantic object orientation of _javascript_ ;-))
[Todays Threads]
[This Message]
[Subscription]
[Fast
Don't ask me why, but you've got to pass your regular _expression_ between
slashes, not quotes: try
UpdprojStart = UpdprojStart.replace(/[\s]*/, -);
One more stupidities of the pedantic object orientation of _javascript_
;-))
I hate to be pedantic myself, but _javascript_ actually offer
Hi all,
I have a little problem with some _javascript_ and a regex that I can't seem
to figure out.
I have the following code:
script language=_javascript_
!--
function dispTest(){
var UpdprojStart = ; //five spaces.
UpdprojStart = UpdprojStart.replace([\s]*, -);
alert(| + UpdprojStart + |);
Sweet.
Thanks for the new info.
Jerry Johnson
[EMAIL PROTECTED] 08/27/02 03:54PM
That's not 100% true.
1. If the first character of a set is a close bracket and there's no open bracket in
the set, then it will match:
[]0-9] will match ]0123456789
2. If the open bracket is anywhere in the
Hi there,
I'm having a problem in CF5 - if I try to use a regular expression to match a pattern
that contains either the [ or ] characters, the find fails. I've already tried
escaping each and using ascii character codes instead of the actual character, but I
can't seem to make it work.
If I
I haven't seen such a problem in the past. If you can post your RegEx we can look it
over and test it.
Hi there,
I'm having a problem in CF5 - if I try to use a regular expression to match a
pattern that contains either the [ or ] characters, the find fails. I've already
tried escaping each
Hi there,
I'm having a problem in CF5 - if I try to use a regular expression to match a pattern
that contains either the [ or ] characters, the find fails. I've already tried
escaping each and using ascii character codes instead of the actual character, but I
can't seem to make it work.
If I
From the Advanced Cold Fusion 5 Application Development, by Ben Forta, page 230:
[ and ] Brackets delimit a character class and are not allowed within the class
itself. Cold Fusion RegEx does not allow them as escaped characters.
Of course, the [:punct:] class handles them as well as all the
That's not 100% true.
1. If the first character of a set is a close bracket and there's no open bracket in
the set, then it will match:
[]0-9] will match ]0123456789
2. If the open bracket is anywhere in the set without a close bracket, it'll match:
[0-9[] will match [0123456789
[[0-9] will
-
From: Michael Dinowitz [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 27, 2002 2:31 PM
To: CF-Talk
Subject: Re: CF Regex problem
I haven't seen such a problem in the past. If you can post your RegEx we can look it
over and test it.
Hi there,
I'm having a problem in CF5 - if I try to use
is This is some text as you'd expect it to be.
Thanks for any ideas,
Matt
-Original Message-
From: Michael Dinowitz [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 27, 2002 2:31 PM
To: CF-Talk
Subject: Re: CF Regex problem
I haven't seen such a problem in the past. If you
56 matches
Mail list logo