Striping HTML Tags From String, But Leaving Paragraph Formatting
I have a string of HTML (used for a specific purpose) that I'd like to
use somewhere else but as plain text. Rather than introduce a
specifically created plain text version I'd like to strip the tags code
from the HTML version. This in itself is easy, using a function such
as:
Function HTMLDecode(Expression)
Dim sTemp
sTemp = Expression
sTemp = Replace(sTemp, ">", ">", , , 1)
sTemp = Replace(sTemp, "<", "<", , , 1)
'Repeat for each defined entity
HTMLDecode = sTemp
End Function
However, the difficulty comes when trying keep each paragraph seperate.
For example, the string "this is<p>my name" shows on screen as:
this is
my name
if I use the above function, it strips out the <p> tag and shows the
result on one line:
this is my name
I thought I could use something like:
str = replace(str, "<p>", chr(10))
but that doesn't seem to work. Can anyone help me replace <br> and <p>
tags with something that's recognised as "plain" text but will keep the
paragraphs and new lines formatted correctly??
View Replies
ADVERTISEMENT
The following pattern is used to strip HTML tags from a string. I need to remove the tags only if they contain a colon. Is it possible? How can I modify this regexp pattern to match only if a colon exists between the "<" and ">" ? Code:
<[^>]*>
View Replies
View Related
I have an asp page that reads the contents of a database and creates an xml news feed. I have code that strips out the <BR> and <P></P> tags, but it looks one of the databases I'm trying to read from uses only <P> without the closing tag.
So the make a long story short, I can't figure out what to add to my code to strip out these tags (or if that isn't the problem at all!) Code:
View Replies
View Related
I need to parse a long string into no more than 30 character chunks, but I also need to leave the words intact. Right now, I am using:
For intStart = 1 to Len(strOriginal) by 30
strPrint = Mid$(strOriginal, intStart, 30)
Print #detailFile, Tab(1), intStart, Tab(4), strPrint
Next intStart
and it's fine, but splits up some of the words. If I could figure out how to find the preceding space of the 30 limit, I'd be in good shape.
View Replies
View Related
I don't know Regular Expressions At All And I Could Really Use Your Help.
Is there a way to extract the paragraphs out of a string?
View Replies
View Related
I have the below mentioned code that I am using to send a simple html email via ASP. Please do let me know how I could modify the code so that the carriage returns are captured and the paragraphs that are entered within the text area are preserved. I do not need any fancy hmtl formatting - just the paragraphs. Code:
View Replies
View Related
i wanna convert the HTML tags in the Textarea with help of the ASP code. Means i m getting some value form DB which comes in the format of
------------
this is text <br><br><ul><li> list-1 value</li><li>list-2 val</li></ul>
------------
i wanna conversion of the above text in textarea
View Replies
View Related
I need to know if there is a standard aproach in ASP ( or any other ) to filter HTML tags. I mean, filter any cross-site scripting code.
View Replies
View Related
I have constructed a simple guestbook application using ASP and a SQL server backend. My problem is that when a person post a message and it displays on the site, if they paste HTML code or any other scripting languages in there, it will post and execute on the site which is what I don't want to happen.
Is there a way or a script out there using ASP that when the user post the message it will scan for key scripting tags and filter them out?
View Replies
View Related
im building a small messageboard and i want to filter all html-tags except these ones:
<b> <i> <img.........> <font....>
how to build such a reg exp pattern?
View Replies
View Related
In my website I've created an admin login with some ASP pages, so I can edit and update stories.I use an acces database and installed HTMLarea for WYSIWYG editing. When I update text, all the HTML tags show als plain text in my website.For example: I make a headline bold in my wysiwig editor and I update my text, it just shows: <B> here's a new story </B>If I look in my database I have a field 'text' wich is a memofield and I can see the html tags have been stored into my database. <B>here's a new story</B>
It looks like it doesnt recognize the html tags as HTML, but just as plain text...
The same problem occurs when I try to use html-tags in my database... so I don't think the editor is the problem... it's just the way my asp-pages retrieve the data from my database..Can I use HTML-tags in an acces database and how do I get them to show up right in my website? So I can make text bold and use breaks and paragraphs?
View Replies
View Related
I'm trying to display a record that has html tags, but I dont want the HTML tags to be written to the source code as tags, I want them to be displayed as regular text. Kind of like this forum right here.
<head>
</html>
These displayed correctly, they weren't written to the source code of this page obviously.
View Replies
View Related
I have an asp email applciation that will be used to create a newsletter. I want to me able to enter a few lines of text into the textarea part of the form. Then if I want to add a hyper link to the textarea. I just want to click a buttom and add the html tags into the body of textarea along with the text I enter above the hyper link.
View Replies
View Related
I'm querying a text field with an 8000 character limit. The text also
contains HTML tags like <p> <br> and more. Is there a way to strip all HTML
tags in the resulting recordset, or do I have to replace each tag
individually?
View Replies
View Related
I've written a script which is still trying to concated couple of messages then send an email. Those messages are a reuqest objects coming from another form as demonstrated below: Code:
View Replies
View Related
I need to display a lengthy html source code within a text area. The problem is, a part of html source code is displayed in the text area and the later part is displayed in the actual html page in which I have the text area. i.e the the html source code is treated as a part of the actual page.
I want to show the whole html source code (which is from the database column) in the text area. Is there any special way to display the html tags in a text area. Hope I have made myself clear enough. how to achieve this?
View Replies
View Related
One of my client requires a technical test with 15 questions, one of the question is given below: Write the code to access the name element in the XML example below.
<XML ID=MyXMLDocument>
<class>
<student studentID=13429>
<name>Jane Smith</name>
<average>65</average>
</student>
</class>
</XML>
-------------------------------------------------------------
The candidate has to write the code for the above giveb question in the textarea box, and since the code contains html tags , i have been facing problems in retrieveing the data from the textareabox in the exact manner has entered by the candidate.
Is there any solution to retrieve the exact code with the html tags.
View Replies
View Related
I have a database in which i store questions and answers, but the questions are about
HTML, Javascript, ASP...... So i store into my database a question like
'How do you make a letter/word in HTML bold? Code:
View Replies
View Related
I just want the raw text of a string so I can display a preview of what is in the file.
View Replies
View Related
I have been trying to figure out how to get a function to strip html tags from part of an html file. The way I need it achieved is as so: Code:
<% strOutput = stripHTML("<!--#include file=includes/MyInclude.asp-->") %>
The included file is html-rich, and if included in default.asp, it displays as such. However, as I am attempting to make my website accessible, I wish to be able to strip out the html tags on the included page dynamically.
I have used the following function (and have called it with the above statement) but am getting an error in my functions.asp file: Unexpected quantifier. This is on the line that states Code:
View Replies
View Related
i have this.asp page:
<script type="text/vbscript">
Function myFunc(val1ok, val2ok)
' do something ok
myFunc = " return something ok"
End Function
</script>
<html>
<body>
<%
val1ok = something1
val2ok = something2
thenewVal = myFunc((val1ok), (val2ok))
%>
</body>
</html>
i want to call and use the returned value of Function myFunc(val1ok,
val2ok) ,without omitting the html script tags and replacing them in <% %>,
(My Question is:) How do i call a function defined in html script tags from asp page?
View Replies
View Related
In PHP I can write something like this:
echo "<option>whatever</option>"
The "" would format my HTML code. How can I get the same result with ASP?
View Replies
View Related
I have one string variable and value stores something
like this:
st = "From: ""John Thomas"" <john@test.com.au>"
when i test it display some thing like
From: "John Thomas" <john@test.com.au>
How can I pick up only display name and without double
quotes. i.e. it should display only
John Thomas
View Replies
View Related
I'm having a problem with the following:
I'm passing a query string from one script to the other via a hidden input.
Right now I'm just response.writing the query string out to make sure the
query is getting there.
The query string will display no problem if the query has no single quotes
( ' ) i.e. returns:
SELECT * from table WHERE int_field = 123 ORDER BY id
But when the query contains quotation marks to handle text it chokes, i.e.
returns:
SELECT * from table WHERE text_field =
when this should be:
SELECT * from table WHERE text_field = 'textvalue' ORDER BY id
I've tried various arguments with the REPLACE function, but can't get it to
work...
Running SQL2000.
View Replies
View Related
I have one string variable and value is stored something like this when I checked using
Response.write st_toadd. It displayed something like this
"John Matthew" <john@abc.com.au>
I want to grab only email address i.e. value between "<" and ">" and it should give me only Join Bytes. what could be the syntax?
View Replies
View Related
All of my previous web page work has been done with .html and Cold Fusion. My new host does not support cold fusion but does have ASP 3.0 and ASP.Net 1.1. They've told me that I have to use CDO.Sys for sending email. I've spent the past 3 days doing all the research I can find but most of the examples assume a basic knowledge of ASP (which I am severly lacking in).
I have a simple .html form (4 fields) that currently DOES get sent through email (although it is sent as plain text). I would like to be able to send an email that is formatted into html (allowing me to use tables, images, etc.
Here is what I have so far (I've commented out the "text" based part and am trying to send as an html email now).
<% @ Language="VBscript" %>
<% Option Explicit %> .....
View Replies
View Related
I was wondering if someone could help me with a formatting problem for ASP/SQL?
Is it possible to format a variable string from a textbox?
I'll try and make it more clear what i want, sorry.
I have a page with a textbox and submit button for users to input a postcode, which then searches a database for matching or similar postcodes.
This is the query i am using: Code:
View Replies
View Related
i am stuck while trying to display a long string, its not just one string though, itsa field from a database that has a problem solution in it, most data is just how to stuff like:
"do this, install this and then restart and install the new stuff... etc."
but some of the solutions have long links to (for example) servers and there is then maybe 150 characters all in a line and no breaks to make the line break - this makes my table (390 pixels wide) get streched to hell on one side.
i have tried going through the code, counting the characters and then taking a "left" of code depending on how many groups of 50 there are but that breaks words in half and thats looks nearly as bad.
View Replies
View Related
I have this:
1 emailBody = "<html>" & vbCrLf _
2 & "<head>" & vbCrLf _
3 & "<title>Interpreter Request details</title> " &
vbCrLf _
4 & "</head> " & vbCrLf _
5 & "<body> " & vbCrLf _
6 & "<font face=Verdana><b>Interpreter Request
details: " & vbCrLf _
7 & "Requestor: </b><u> <% strFName strLName %></u>"
& vbCrLf _
...
& "</body> " & vbCrLf _
& "</html> " & vbCrLf
In line 7, I need to display the results of the variables strFName and
strLName (and have a space in between the two) but I don't know the proper
formatting. If I just use the & then I get the literal strFname instead of
the value. Could someone please show me the correct syntax for this?
View Replies
View Related
I would like to display a lot of binary source image in one html document. Those image are read from ms acess database
I know only read and display one image, such as:
Response.ContentType = "image/jpeg"
Response.BinaryWrite rs.Fields("iamge")
But, this cannot display any text and other image, only an image can see in the browser.
View Replies
View Related
I want to create a cookie that will expire in a few mintues after a user leaves my page so that they can return without having to login again if they were only gone for a few minutes. I tried putting this code in the Page_Unload event but got an error message that cookies not supported here.
....
Sub Page_Unload 'this not working here
Dim objCookie As HttpCookie
objCookie = New HttpCookie("mycookie", "cookie1")
objCookie.expires = DateTime.Now.AddMinutes(2)
Response.Cookies.Add( objCookie )
End Sub
</script>
What is the best place to create a cookie that will only last for a few mintues after leaving a page.
View Replies
View Related
For my CMS, currently I am using a function for stripping HTML tags.
It's
Function SQLMemo(strSQLMemo)
strSQLMemo = Replace(strSQLMemo, "'", "''")
strSQLMemo = Replace(strSQLMemo, Chr(13), "")
strSQLMemo = Replace(strSQLMemo, Chr(10) & Chr(10), "</p><p>")
strSQLMemo = Replace(strSQLMemo, Chr(10), "<br />")
strSQLMemo = "<p>" & strSQLMemo & "</p>"
SQLMemo = strSQLMemo
End Function
Now, I actually want to allow only the following tags for the messages.
<p>, <b>, <i>, <a>, <em>, <br>, <br />, <strong>, <img>, <center>, <blockquote>, <tt>, <li>, <ol>, <ul>, <div>.
are there any easy way of doing this?
View Replies
View Related
I need to return only string value from a html string
For eg.
<html>aaaa</html>
Currently, i use replace function to replace the html tags to obtain the string aaaa.
But it is tedious as i will need to code all the possible html tag.
View Replies
View Related