Take A Paragraph Out Of String
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?
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?
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??
I've had some excellent help before on this forum and hoping for some more.
This is probably very basicbut I'm kind of muddling along a bit and it's a miracle I got so far.I have a memo text field in a table form and I'm wanting to enter text into it but all a small amount of formatting. Just basic paragraph breaks would be a start. This is kind of following on from a previous post of mine where I was trying to include line breaks. This was the solution.
Code:
<textarea name=whatever WRAP="HARD">
I am trying to send an email with the values from a form. I want to send the text field values as paragraphs on the email. It comes as one paragraph and there is no break.
View Replies View RelatedI am using TEXTAREA as input. While entering texts sometimes I am creating paragraph and save them .But when I retrieve from database it comes without paragraph.
Is there any way we can create paragraph in TEXTAREA?
I have a query about ASP with Javascript, I am trying to automate a form whereby when you type in some text in a form and hit the return key on your keyboard the asp/javascript places a <p> html marker in that paragraph space so when you hit the submit button the text is display correctly, i.e. the paragraphs are displayed and the text does not come out in one block. I have created a very simple form and button using ASP/VbScript and it works. For some reason I cannot work out how to do this with ASP/Javascript. This is so when in future all text is sent to a database we do not have to input the <p> markers manually. Obviously there is more to this, like connecting to a database to drag the text off first, but the code I have created is merely for testing purposes first.
here is my ASP/VBScript code below: ...
Is it possible to extract the first paragraph in a mysql text field? my code line to display all text:
<%=replace(Recordset.Fields.Item("article").Value, vbcrlf, "<p>")%>
I want to separate the 1st paragraph (article lead) from the others (article), without having one table for 1st paragraph and a second one for the rest of the text.
I am building a small CMS for my son's school. Ideally I want to build the system for them and hand it over so that all updates can be done through web-based forms.
So far so good. However I'm having a problem with fields designed to take multi-paragraph stories or articles. I'm using a text area field on the form which saves the data in a memo field in the database. Teachers would typically cut and paste stories from word documents into the text area field.
However when the data is loaded back into the website from the database all the carriage returns have been removed and the story consists of one long paragraph.
I have a form with a textarea input. The form then stores the text in a database. I want that text to be written to a web page (not a textarea).
Well if I don't put a <p> in between paragraphs, of course the paragraph breaks don't show up on the web page. How can I make it, so when I hit return in the text area, a paragraph break shows up in the asp page?
I ve a text paragraph something like
sample sample sample sample Join Bytes! <ee@ss.comsample sample
sample sample sample sample sample sample sample sample
Join Bytes! sample sample sample <ww@example.comsample sample
sample sample sampl Join Bytes!
i want to extract email ids from the above text paragraph.. using
Active server pages or php can u give me some clue to find a
solution.
i ve tried some regular expression technique to sort out this problem
but.i cant get the proper output
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:
I have a scrolling text box where people input a list of information, using the <ENTER> key between lines.
The submit button transfers this information into the Access DB into a memo field.
When I try and pull up the information using Response.Write, all of the line breaks are gone, its just moshed together.
What better way is there to do this so my line breaks are intact?
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 RelatedI'm developing an Asp.NET system to take a CSV file uploaded via the web, parse it, and insert the values into an SQL database. My sticking point comes when I try to split() the string returned by readline() on the file.
The following code snippet works for me:
tokens = "one,two,three,four".Split(",")
for each token in tokens
response.write("<td>"+token+"</td>")
next
However, if I take the next line in the CSV, read using StreamReader.ReadLine on the PostedFile.InputStream, I receive "Object reference not set to an instance of an object." which I have narrowed down to be my string holding the line. Further investigation reveals that no other string member functions work on my line (.ToCharArray, .ToString, etc).
I suspect that StreamReader.ReadLine is not correctly returning a string, even though Response.Write(line) displays what I would expect .....
I have a form in which several elements are expected to be all digits. Some of those elements can be left empty, but if specified they must be all digits. I have this Sub to edit them: ....
View Replies View RelatedI am pulling info from a sql server By default the query pulls back the inforamtion as text.Therefore when I go to calculate some figures its giving me a type mismatch error.
Is there a function in can call to convert a text string to an integer string using
rstSearch.Fields("name").Value .To pull back the info in a for loop
Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch
If a visitor doesn't put anything in the "Search" text box I'd like them to
be redirected to where they came from before the search form forwarded them
to the search.asp page. Therefore I've put the following at the top of
search.asp to do this.
I am trying to search my access database for a string using LIKE and a wildcard.
Example:
Code:
Dim con
con = "SELECT names.* WHERE name LIKE 'sam*'"
For some reason this gives me no results even though I verified there is entries with the word sam in them.
Also tried using % instead of *. Also took out wildcard. I can search for an integer without a problem though, when I try a string, regardless if there's relevant entries I get nothing back at all.
I am using an SQL statment with a LIKE clause. I am trying to print the actual SQL statement on the screen. However I cannot print a '%' character on the screen. I tried using Chr code and just % outright.
Random variables:
name, rank
Code:
sSQL = "SELECT * from myTable WHERE myField LIKE '" & name & "%'"
It just prints on the screen: (assume name=joe)
"SELECT * FROM myTable WHERE myField LIKE 'joe'"
i have an object which is a string, (objrs4("points")) how do i convert it into int numbers.
View Replies View Relatedi need requirement for the current assignment Im working on.Part of my assignment I have to saved updated data from a datagrid and put into database. I had everything working, but without option strict and explicit. When I put it on i'm having trouble getting the value out of it.
What I need is to get the value out of the textbox control of a datagrid in edit mode. The value is supposed to be in Item.cells(2).Controls(0) but I have no clue on how to get it out correctly. Ive tried everything but keep getting errors that it cannot be converted to a string.
the subject that i need to filter the URL from a memo field that having lots of URL in it, like when we post a message with URL www.websourceinfo.com it will become a base url link with click
View Replies View RelatedI searched google for this (probably easy to solve) problem, but all answerd there did not work hop someone can help me out.In an asp I want to check whether a string contains a " if so the response should be that the "-sign is not allowed.
Elseif InStr(1, username, """) > 0 then Response.Write "-sign is not allowed in the username."
Tried char(34) and /" and """ but none of these options seem to work.
I guess this is easy, but I ask anyway.How can I cut 'www.' and '.no' or '.com' from a string?
example input:
www.norway.no
www.somewhere.com
I want this output:
norway
somewhere
How can I do this?
splitted from this thread, I need to dosomething similar i need comare 2 variables. one of them conaints the other variable but have more information
i need compare
a= "red car"
b= "red"
and then i need ask if is b in A then c=b but i dont know how.
converting string to hex like so:
for x = 1 to len(source)
target = target & hex(ascw(mid(source,x,1)))
next
How to convert it back to a string?
I got as far as:
for x = 1 to len(source) step 2
target = target & chr("&H" & mid(source,x,2))
next
but this fails with the pound sign (£ - £)
This seems like it should be so simple. I would like to create a conditional statement based on the length of a string. The string is a memo field from an Access database. I would like to handle long memos differently from short ones. I'm starting out just by trying to write out the length of the string:
memo = RS("Idea_Note")
Response.Write Len(memo)
I can response.write the memo without trouble, but I get nothing for the length of the memo.
I have a drop down list of ssn and text box to input ssn to view the info in the next page. I am having a problem with displaying and when I debugged the code, I am getting a comma next to the ssn. Here is my code the dropdown and input type:ssn is text field. Code:
<table>
<tr>
<td>
<Select name=ssn >
<%response.write("<option value=""" & RS("ssn") & """>" & RS("ssn") & "</option>" & vbcrlf)%></td>
<td><input type=text name=ssn value="">
</tr>
</table>
In next page when I response.write ssn, I am getting the ssn as: 123456789, why am I getting a comma next to the ssn?
I got this huge query string that works well if I put something like this:
"select * from table"
in the table, there is a field called result wich is a varchar
so if I write "select * from table where result=" & result it says:
Microsoft OLE DB Provider for SQL Server error '80040e07'
Conversion failed when converting the varchar value 'E' to data type int.
/backoffice/ac_medica/operadores.asp, line 82
I'm gonna need the same for dates later... Can anyone tell me how?
I am wondering if any body can guide me on how to break up a string so that i can use the first letter as a querystring.
View Replies View RelatedI need to create some .asp pages to publish data from our manufacturing lines...but I can't figure out how to establish the connection string and print the data. I've been stuck on this all day and about to start pulling my hair out!!!
As an example, can someone create the most basic code necessary to build a web page that does the following:
a) connect to a SQL version of the Northwind db (assume I have a functioning ODBC connection called 'Northwind_ODBC' on a server called 'ProductionServer')
b) Loop through the records in the [Shippers] table and paste the values in a HTML table (using SELECT * FROM SHIPPERS)
I know it sounds simple but I'm looking through some books and can't find a solution that works on my server.
NOTE: I'm running Server 2003 (with IIS), SQL Server 2000, and I have proven ASP does work on this machine...unfortunately, just not with the code I'm trying to build!!!
Im trying to create a string from checkboxes that have been checked, but for some reason its not working
strNumbers = ""
for each key in request.form("chkFacility")
strNumbers = strNumbers + "" & key & ","
intCount = intcount + 1
next
So I want to end up with a string like this '3,12,7.' Instead Im just getting a single number. Am I doing this the right way. Any help wud be just fantastic!!
I am passing the following variables....
City - name of city
RentLow - low range of rent
RentHigh - high range of rent
myquery - keywords
The following is the start of my query string but I am having issues with the City portion already and I have not gotten to the rent yet
I know the SQLquery portion right below is fine - it tested perfectly, along with the rest of the query, it was when I added in the request city string that gives me No value given for one or more required parameters. even though one is passed in the string.
SQLquery = "(" &parsethis(strText ,words ,wCount, 3) & ")"
SQLquery = Replace(SQLquery, "<FIELD1>", "title")
SQLquery = Replace(SQLquery, "<FIELD2>", "description")
SQLquery = Replace(SQLquery, "<FIELD3>", "comments")
SQLstr = "SELECT * FROM links WHERE " & SQLquery & " AND city = " & Request.QueryString("city") & " AND linktype = 2 AND active = " & myTrue & " " & SortSQL & ";"
end if