Re: Replacing characters in a string

2009-08-20 Thread Peter Boughton

 This wouldn't match anchor tags with upper case,
  but could be changed like so:
 /?[a|A][^]*

You've got two syntaxes mixed up there.

(?:a|A) or [aA] is what you want - no bar needed for square brackets.


 And I think it might be best to use a lazy match:
 
 /?[a|A][^]+

That's not a lazy match - it's still greedy, just with a 1-char minimum match 
(which means it wont now remove /a).

To make it lazy, you would want *? or +? except you don't actually want to make 
it lazy here.

If anything, instead of greedy it should be possessive (using *+ or ++) but 
with the example here posessive wouldn't make much difference.
(It's main benefit is for when you've got almost matches which you want to 
exclude faster, as possessive prevents backtracking.)

And either way, you can't do possessive with the CF regex engine - you'd need 
to use the Java one:

cfset ad = form.addesc.replaceAll( '/?[aA][^]*+' , '' ) /

But since there's minimal benefit and that syntax would confuse some people, 
I'd probably just stick to:

cfset ad = rereplace(form.addesc , '/?[aA][^]*' , '', 'all' ) /


And I'd like to call specific attention to the lack of parentheses compared to 
the earlier suggestions, because they're completely unnecessary. 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325562
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Replacing characters in a string

2009-08-20 Thread Jason Fisher

Good call on the parens.  I had those in the original since I had ripped 
from code that did use the /1 element later on.  Also, you could use 
#reReplaceNoCase()# as an alternative to [aA] ... but I like the [aA] 
better, for no particular reason.
 


~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325563
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Replacing characters in a string

2009-08-19 Thread Rick Sanders

Hey all,

 

I'm trying to replace a hyperlink and just display the text. I need to
remove the a href=http://www.google.ca;www.google.ca
http://www.google.ca%3c/a /a from text within fckeditor and just display
the text www.google.ca I tried finding a setting for the editor so it
doesn't automatically create hyperlinks when you type www. Or http:// but
didn't see such a setting.

 

Here's what I have so far:

cfset ad = Replace(#form.addesc#, http://,;)

cfset ad2 = Replace(#ad#, a href=#chr(34)#,)

cfset ad3 = Replace(#ad2#, #chr(34)#,)

cfset ad4 = Replace(#ad3#, /a,)

cfoutput#ad4#/cfoutput

 

It works, but it duplicates the link. How can I remove the duplicate?

 

Thanks,

 

Rick Sanders

Webenergy

Canada: 902-431-7279

USA:   919-799-9076

Canada: www.webenergy.ca

USA:   www.webenergyusa.com

 





~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325545
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


re: Replacing characters in a string

2009-08-19 Thread Jason Fisher

Try this:

cfset ad = reReplace(form.addesc, (/?a[^]*), , all) /
 


~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325546
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Replacing characters in a string

2009-08-19 Thread Andy Matthews

Just so you know, this is what that expression is doing:

/ - literal string
? - zero or one
a - literal string
[^] - character set which says everything BUT 
* - zero or more times
 - literal string

So the expression says
1) Look for a 
2) With zero or one /
3) Followed by a
4) Any character (but ) any number of times
5) Followed by a 

This wouldn't match anchor tags with upper case, but could be changed like
so:

/?[a|A][^]*

And I think it might be best to use a lazy match:

/?[a|A][^]+

The plus says one or more rather than zero or more like the kleene star.


Andy matthews


 

-Original Message-
From: Jason Fisher [mailto:ja...@wanax.com] 
Sent: Wednesday, August 19, 2009 2:38 PM
To: cf-talk
Subject: re: Replacing characters in a string


Try this:

cfset ad = reReplace(form.addesc, (/?a[^]*), , all) /
 




~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325548
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Replacing characters in a string

2009-08-19 Thread Rick Sanders

Hello Andy  Jason,

Thank you so much, this worked well. I wasn't sure of the syntax so this
really helped.

Kind regards,

Rick

-Original Message-
From: Andy Matthews [mailto:li...@commadelimited.com] 
Sent: August-19-09 6:19 PM
To: cf-talk
Subject: RE: Replacing characters in a string


Just so you know, this is what that expression is doing:

/ - literal string
? - zero or one
a - literal string
[^] - character set which says everything BUT 
* - zero or more times
 - literal string

So the expression says
1) Look for a 
2) With zero or one /
3) Followed by a
4) Any character (but ) any number of times
5) Followed by a 

This wouldn't match anchor tags with upper case, but could be changed like
so:

/?[a|A][^]*

And I think it might be best to use a lazy match:

/?[a|A][^]+

The plus says one or more rather than zero or more like the kleene star.


Andy matthews


 

-Original Message-
From: Jason Fisher [mailto:ja...@wanax.com] 
Sent: Wednesday, August 19, 2009 2:38 PM
To: cf-talk
Subject: re: Replacing characters in a string


Try this:

cfset ad = reReplace(form.addesc, (/?a[^]*), , all) /
 






~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325553
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Replacing characters in a string

2003-01-07 Thread Ryan Mitchell
This should be a simple enough one...

I have a credit card number, 16 digits long, and I want to star (*) out the
middle 8. How do I do this?

TIA
Ryan


~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



RE: Replacing characters in a string

2003-01-07 Thread Robertson-Ravo, Neil (RX)
take the numberread the first 8 numbers and the output them with
hardcoded *'s.

 simple

Or do you mean by Javascript as they type?

N

-Original Message-
From: Ryan Mitchell [mailto:[EMAIL PROTECTED]]
Sent: 07 January 2003 12:56
To: CF-Talk
Subject: Replacing characters in a string


This should be a simple enough one...

I have a credit card number, 16 digits long, and I want to star (*) out the
middle 8. How do I do this?

TIA
Ryan



~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



Re: Replacing characters in a string

2003-01-07 Thread Ryan Mitchell
Nope, I mean by a cf method.
Ill give this a go thanks,
Ryan

On 7/1/03 12:55, Robertson-Ravo, Neil (RX)
[EMAIL PROTECTED] wrote:

 take the numberread the first 8 numbers and the output them with
 hardcoded *'s.
 
 simple
 
 Or do you mean by Javascript as they type?
 
 N
 
 -Original Message-
 From: Ryan Mitchell [mailto:[EMAIL PROTECTED]]
 Sent: 07 January 2003 12:56
 To: CF-Talk
 Subject: Replacing characters in a string
 
 
 This should be a simple enough one...
 
 I have a credit card number, 16 digits long, and I want to star (*) out the
 middle 8. How do I do this?
 
 TIA
 Ryan
 
 
 
 
~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



RE: Replacing characters in a string

2003-01-07 Thread Pascal Peters
Insert(,RemoveChars(ccnumber,5,8),4)

-Original Message-
From: Ryan Mitchell [mailto:[EMAIL PROTECTED]] 
Sent: dinsdag 7 januari 2003 13:56
To: CF-Talk
Subject: Replacing characters in a string


This should be a simple enough one...

I have a credit card number, 16 digits long, and I want to star (*) out
the middle 8. How do I do this?

TIA
Ryan



~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



RE: Replacing characters in a string

2003-01-07 Thread Everett, Al
cfset maskedCCnumber=Left(CCnumber,4)  RepeatString(*,8) 
right(CCnumber,4)


Remember: Amex numbers are 15 digits long.

 -Original Message-
 From: Ryan Mitchell [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, January 07, 2003 7:56 AM
 To: CF-Talk
 Subject: Replacing characters in a string
 
 
 This should be a simple enough one...
 
 I have a credit card number, 16 digits long, and I want to 
 star (*) out the
 middle 8. How do I do this?
 
 TIA
 Ryan
 
 
 
~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



RE: Replacing characters in a string

2003-01-07 Thread Ryan Emerle
Yet another way.. With regular expressions:

cfset maskDigits=8
cfset masked=REReplace(CCnum,^[0-9]{#maskDigits#},repeatString(*,maskDigits))

-Ryan

-Original Message-
From: Ryan Mitchell [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 07, 2003 7:56 AM
To: CF-Talk
Subject: Replacing characters in a string


This should be a simple enough one...

I have a credit card number, 16 digits long, and I want to star (*) out the
middle 8. How do I do this?

TIA
Ryan



~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



RE: Replacing characters in a string

2003-01-07 Thread Ryan Emerle
Sorry.. MIDDLE eight.. Now it gets ugly with regEx..

cfset 
masked=REReplace(ccnum,([0-9]{4})[0-9]+([0-9]{4}),\1#repeatString('*',8)#\2)

-Ryan
-Original Message-
From: Ryan Emerle 
Sent: Tuesday, January 07, 2003 10:47 AM
To: CF-Talk
Subject: RE: Replacing characters in a string


Yet another way.. With regular expressions:

cfset maskDigits=8
cfset masked=REReplace(CCnum,^[0-9]{#maskDigits#},repeatString(*,maskDigits))

-Ryan

-Original Message-
From: Ryan Mitchell [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 07, 2003 7:56 AM
To: CF-Talk
Subject: Replacing characters in a string


This should be a simple enough one...

I have a credit card number, 16 digits long, and I want to star (*) out the
middle 8. How do I do this?

TIA
Ryan




~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4