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,
5 matches
Mail list logo