Re: RegEx Problem Trying to Use Matched Text

2004-09-09 Thread Ben Doom
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

[[:alnum:[EMAIL PROTECTED]:alnum:]]+\.(com|net|org)

Does that help some?

BTW -- you can also mix this notation with the traditional bracketed 
class notation.  So, if you want "alnums" and underscores, you could use
[[:alnum:]_]
Just be careful with hyphens -- standard rules there apply.

--Ben

Josen Ruiseco wrote:
> 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
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]
 [Donations and Support]




Re: RegEx Problem Trying to Use Matched Text

2004-09-08 Thread Jeff Price
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 space
lower	- lower case letters
print	- the "printable" characters
space	- whitespace characters
upper	- upper case letters

as opposed to the \s, \w, \d that perl and a few other languages use.

-Jeff
GO PACK!
> 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
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]
 [Donations and Support]




RE: RegEx Problem Trying to Use Matched Text

2004-09-08 Thread Jason Reichenbach
Heres a regex I use for email address finding. Maybe this can get you
moving in the right direction


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 Matched Text

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 email address twice. The second
string is not a link.
> 
> 
> #newString#
> 
"([EMAIL PROTECTED])", "
> #newString#
> 
> Am I not doing something right? I'm on CF5.
> 
> Josen

  _
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]
 [Donations and Support]




Re: RegEx Problem Trying to Use Matched Text

2004-09-08 Thread Josen Ruiseco
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 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:
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]
 [Donations and Support]




Re: RegEx Problem Trying to Use Matched Text

2004-09-08 Thread Ben Doom
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 email address twice. The second string is not a link.
> 
> 
> #newString#
> 
> #newString#
> 
> Am I not doing something right? I'm on CF5.
> 
> Josen
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]
 [Donations and Support]




Re: RegEx Problem Trying to Use Matched Text

2004-09-08 Thread Josen Ruiseco
I am using the following and I get the email address twice. The second string is not a link.


#newString#

#newString#

Am I not doing something right? I'm on CF5.

Josen

>In CF it is \1 : "
>
>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
>> Expressions in 10 Minutes" book. The example does a simple replace
>using
>> matched text and reReplaceNoCase().
>> 
>> 
>> #newString#
>> 
>"([EMAIL PROTECTED])",
>> "
>> #newString#
>> 
>> The problem is that it doesn't seem to replace the matched text when
>using
>> the $1.
>> 
>> Am I missing something here?
>> 
>> Josen
>> GoMotorsBids.com
>> 
>>
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]
 [Donations and Support]




RE: RegEx Problem Trying to Use Matched Text

2004-09-08 Thread Pascal Peters
In CF it is \1 : "

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
> Expressions in 10 Minutes" book. The example does a simple replace
using
> matched text and reReplaceNoCase().
> 
> 
> #newString#
> 
"([EMAIL PROTECTED])",
> "
> #newString#
> 
> The problem is that it doesn't seem to replace the matched text when
using
> the $1.
> 
> Am I missing something here?
> 
> Josen
> GoMotorsBids.com
> 
>
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]
 [Donations and Support]




RE: RegEx Problem Trying to Use Matched Text

2004-09-08 Thread Michael Dinowitz
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 on page 82 of Ben Forta's "regular
Expressions in 10 Minutes" book. The example does a simple replace using
matched text and reReplaceNoCase().


#newString#

"
#newString#

The problem is that it doesn't seem to replace the matched text when using
the $1.

Am I missing something here?

Josen
GoMotorsBids.com 
  _
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]
 [Donations and Support]




RegEx Problem Trying to Use Matched Text

2004-09-08 Thread Josen Ruiseco
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().


#newString#

#newString#

The problem is that it doesn't seem to replace the matched text when using the $1.

Am I missing something here?

Josen
GoMotorsBids.com
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]
 [Donations and Support]