 |
|
|
|
|
|
|
 |
09-16-2005, 03:26 PM
|
#1
|
|
Guest
|
wildcards in replace command?
Is there a way to use wildcards in the replace command?
I'd like to strip the html from text boxes before we put it into the database.
This is what I wrote but it doesn't work.
<cfset form.textbox = ReplaceNoCase(form.textbox,"<a href="*">","","all")>
I downloaded a html stripper that has this code in it but I don't understand
it and it doesn't seem to work.
<!--- Do replacement work here --->
<cfset temp = SetVariable("caller.#attributes.variable#",
REReplaceNoCase(attributes.input, "<[^[:space:]][^>]*>", "", "ALL"))>
|
|
|
|
09-16-2005, 04:12 PM
|
#3
|
|
Guest
|
Re: wildcards in replace command?
still not working
|
|
|
|
09-16-2005, 04:14 PM
|
#4
|
|
Guest
|
Re: wildcards in replace command?
The UDF worked fine for me. Can you be more specific? Can you post some code with an example of the value(s) giving you problems?
|
|
|
|
09-16-2005, 04:26 PM
|
#5
|
|
Guest
|
Re: wildcards in replace command?
I added the line to the demoroize script.
This is how the precessing page is written:
<!--- format the comments field --->
<CFSET form.Comments = #boxFormat(form.Comments)#>
<CFSWITCH expression="#URL.Action#">
<CFCASE value="add">
<CFQUERY name="addEntry" datasource="#Application.dsn#">
insert into
guestbook(Name,Email,NoEmail,Location,Homepage,Com ments,IPAddress,EntryDate)
values('#form.Name#','#form.Email#',
<CFIF isdefined("form.Noemail")>1,<CFELSE>0,</CFIF>
'#form.Location#','#Homepage#','#form.Comments#',' #cgi.REMOTE_ADDR#','#DateForma
t(now())#')
</CFQUERY>
here is the end of the demoronize script
<CFSCRIPT>
// DEMORONIZE CODE BLOCK HERE
// remove html
field = REReplaceNoCase(field, "<[^>]*>","","ALL");
return field;
}
</CFSCRIPT>
|
|
|
|
09-16-2005, 04:44 PM
|
#6
|
|
Guest
|
Re: wildcards in replace command?
it does work fine. i was calling the demoronize script incorrectly
|
|
|
|
09-16-2005, 04:44 PM
|
#7
|
|
Guest
|
Re: wildcards in replace command?
I'm not sure why you are using "return" in this context. I think that may be
the problem.
The following worked fine
<form method="post">
<input type="text" name="testValue" value='<a
href="http://www.SITENAME.com">sitename</a>'>
<input type="submit">
</form>
<cfif IsDefined("form.testValue")>
<cfscript>
newValue = REReplaceNoCase(form.testValue, "<[^>]*>","","ALL");
</cfscript>
<cfoutput>
<b>orig:</b> #HTMLEditFormat(form.testValue)#<br>
<b>new:</b> #HTMLEditFormat(newValue)#
</cfoutput>
</cfif>
|
|
|
|
09-16-2005, 04:45 PM
|
#8
|
|
Guest
|
Re: wildcards in replace command?
can you explain how this code works? I don't understand the markup.
|
|
|
|
09-16-2005, 04:47 PM
|
#9
|
|
Guest
|
Re: wildcards in replace command?
You mean the UDF itself: stripHTML() .... or ...the regular expression : REReplaceNoCase(field, "<[^>]*>","","ALL");
|
|
|
|
09-16-2005, 04:55 PM
|
#10
|
|
Guest
|
Re: wildcards in replace command?
sorry this part of the code
REReplaceNoCase(field, "<[^>]*>","","ALL");
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Adobe Newsgroups | Software Newsgroups
Powered by: vBulletin Version 3.0.7 Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2003-2004 All Rights Reserved GroupBrowser LLC.
|
 |