why the following code incorrectly returns 2 as matches count whereas when I change str = "179,80,179,80,179" I get the correct count which is 3? str = "179,179,179" num = 179
Set regEx = New RegExp regEx.Global = true regEx.IgnoreCase = True regEx.Pattern = "(^|,)" & num & "($|,)"
Set colMatches = regEx.Execute(str) response.write colMatches.Count & "<BR>"
I have a string which is an html document - I want to eliminate all the <script>blah blah</script> tags. I can't seem to get the regexp pattern right. Here's where I've got to:Code:
Set oReg = New RegExp oReg.IgnoreCase = True oReg.Pattern = "(<script[. ]*</script>)"
Set oMatches = oReg.Execute(sHTML)
For Each oMatch In oMatches sHTML = Replace(sHTML, oMatch.Value, "") Next
I am trying to write an asp(vbscript) parser for wiki-style pseudo code, and can't get my head round regexp.
I am hoping if somebody could give me an example to work on for one, I could sort the others.
e.g. how do you turn (from within a large string, with varying occurences) .......[image:/mydir/pics/my portrait.jpg | A picture of me]...... into ......<img src="/mydir/pics/my%20portrait.jpg " alt="A picture of me">.....
I'm struggling trying to get the concepts of the regExp function down....
What i'm trying to achieve is to remove all white space from html formatted source code.
I have the following regExp search string to remove all html source code but that is not what i require.. RegExp.Pattern = "<.*?>"
I want to store all html source code and its text/image contents into a DB.
For that reason i want to remove all line breaks and spacing/tabs within the source code so as to only have one exteremely long single line leaving the formatting of the contents of the html code alone all so that i can stuff into a varchar(MAX) field.
what is the syntax for parenthesis? but i don't want to allow <> or / like S would (if i understand that correctly). would i use ascii then, as in: x40 and x41?
Premise: Inserting data into a database form a <textarea> and displaying this data through an HTML page.
When inserting data into a database via a text area and then displaying this data any carriage return that was entered into the database was lost. I Created a function to replace a carriage return with a <BR>. I call this function when I display this data.
If I enter text inside <> into a database and then display this data, any text that was within the <> is lost because it is considered an HTML tag. How can I search the string for the brackets and actually diplay them? I do not want to use Server.HTMLEncode before I insert the data into the database. This is because we often query the database from outside a web browser.
Here is my function I have for the carriage return. I need to figure out how to accomplish this for both < and >. I am sure this is simple but I do not know what the .pattern should be (for a carriage return it is " ".
SET regQuote = New RegExp regQuote.pattern = " " regQuote.global = True catchCR = regQuote.Replace(strText, "<br>")
I have a bit of code that replaces all links in my forums with hyperlinks. I'd like to add [url=www.sitehere.com]Link[/url] BB Code links to my forums. This is difficult to word, but how do you specify for RegExp to skip links if they are in [url] tags.
I have some code working with Regular Expressions and it works right on my server (W2K Server), but doesn't work on all IIS 5 servers. I originally thought that the servers just didn't have the RegExp object, but a testing script shows that the problem is in the replace statement. Code:
I'm not so familiar with ASP, so don't shoot me if this one's easy. I have to redesign the front of a Belgian hosting company. On that front they have a domain check like this:
Input field (domain without extension) Hidden fields with populair basic extensions
(<input type=hidden name=ext value=be> <input type=hidden name=ext value=com> ...) Submit button What I want now when the the user submits this form is that IF he adds an extension in the first field (which is not required), the script also checks if that extension is available. Code:
I just realized that it's so important to validate each string, I mean 'each' before you insert data from asp page into database.
I guess some customers just copy data from some electronic document and paste intoform field which it will probably mess up the program.
for example, we have a customer who wants to enter AH12345 into one of our fields, it appears Ð?Ð?12345 in hidden field of our asp page, but it displayed AH12345 to the customer, but our program failed because of the data does fit into char field in sql database.
I don't know in reality, how other companies deal with those kind of thing. Do I have write our own regExp to validate each string, since we do need to allow apostrophe or "-" in first name or last name.
is it possible (i heard u can replace) to filter out bad words using regexp? I'm using Replace() but it sucks without ALOT of extra code... but using regexp it seems better, with ignorecase, etc.
I need to truncate a news article to only show a certain number of characters on the front page. the news articles often contain html and the characters in the html are being counted. So, even though I want the text to be truncated at, say, 350 characters, the final result on the page looks like it's been truncated way further up, because the text of the html added to the character count.
here's the code i'm using to truncate
URLFunction ChopLastWord( Line, Length ) If Len(Line) < Length Then ChopLastWord = Line Exit Function End If Dim spaceat spaceat = InStrRev( Line, " ", Length ) If spaceat < Length-20 Then spaceat = Length ' value of 20 is arbitrary ChopLastWord = Left( Line, spaceat ) & "..." End Function
2) when highlighting words (in a search results page for example), I want to match the word ignoring case. however, when wrapping the word in highlighting code and replacing the substring, I want to keep the original capitalization.
for example, if the word to match is marvelous, but the word is stored uppercase in the db, the above code will replace the word with a lowercase version. how do I get around this?
3) I want to remove any and|or that are not inside double quotes in a string. for example,
test = """The dog and the cat""" & " and fox or mouse " & """the cat and the dog"""
resulting in "The dog and the cat" and fox or mouse "the cat and the dog"
I would like to remove only the AND OR linking fox and mouse in the middle of the string. how would I do that?
set typ = server.createobject("Scriptlet.TypeLib")
to create a random string of 36 characters. However, is there a way to create a random string of digits in the length I request? Perhaps a string of 20 digits with a few asterisks thrown in for ease of typing?
I'll admit my ASP skills are very rusty, and come seeking help.
I'm currently using a dictionary object to store a multi-dimensional array.
I want to pass this dictionary object to an object, which holds an array of dictionary objects.
However I'm finding that the array is not getting set, thus I'm having great issue with dynamically resizing the object's property for every new dictionary object I'm adding.
I have a VC++ COM object which fires an event. I've written VB EXE apps against it and they receive the event notification.
I've now built a simple VB COM object which uses the VC++ COM object internally.
My question is, assuming the ASP page which loads the object does not immediately exit, will the VB COM object be able to receive the events from the internal object?
We are using .net 1.1 on windows 2003 server. This is we are facing in our production server.
When we are doing the load testing we are getting the bellow error. While the load testing this error is not coming frequently. When we run 20 threads for 3 mins we are getting this error message 2 or 3 times. But this line of code is executed by all the threads. Code:
I want to open a recordset object on an .asp page. When I open the recordset I would like to use a stored procedure that expects a parameter to be passed for the stored procedure. I will then use the recordset to loop thru the recordset, update values from the recordset and then update the database by passing parmeters to another stored procedure.
I would like to use the recordset object but can it be used to pass a parameter to a stored procedure? Do I need to use a command object to open the records instead in order to pass the parameter to a stored procedure?
A three-tier user authentication system was running without a problem for almost a year and now is suddenly dysfunctional. We don't know of any changes to any of the servers. It's quite maddening. The details:
1) We know the COM+ app is instanced on the COM+ server (Win 2000). The component graphic spins when CreateObject is called.
2) The proxy is installed on an IIS server (Win 2000) with delivers the interface, written in ASP, to the client PC.
3) These are the error messages displayed when a method of DAMS is called: Code:
I have one column in my access database named 'picture'. I uploaded the pictures in the database using OLE Object. Now I want to have a picture of an employe in my ASP form. It gives me an error. The page works without that code-line where picture is mentioned. Code:
I have an xml data that I want to store in a database.
I want the following fields 1. Account-id 2. order-number 3. first-name 4. last-name 5. address-line 6. address-line-2 7 city 8, state 9 postal-code 10 total-points-spent 11 the list of items that were purchased which are in the section item-redeemed
And this is the asp code that I use to move through the list. right now all I can get is the redemption top-level, but I cannot seem to go down to the subitems. Code:
I am creating an e-mail using the CDO object and using the AddAttachment method to attach a file from a URL. I am having a problem in that the file file attached is given a random name (something along the lines of ATXX412.pdf)
Does anyone know if it is possible to rename/assign a name to attached file before the e-mail is sent?
I am writing a function to take a recordset as parameter, and print a HTML Select element according to the record in the recordset. I would like to check if the input object a RecordSet before processing, how can i acheived that?
I have a table called "Document" which has 3 columns
Doc_ID Doc_Name Doc (this is a word doc stored as an OLE object in ms access)
Now in my asp if the user selects a document it should open the word file. I have my case statement that looks like as follows which I think might need some modifications to open a word file: Code:
I have an E-mail ASP Web form that is using a CDO Mail Object. This form has to be filled out before the customer can download our demo. Currently, the customer fills out the form, clicks to submit and a message appears to the customer telling them it was successful and to click on a picture on the form to download the demo. My problem is that many of the customer don't read the message. I want to modify the code so that after the customer clicks SUBMIT, the info is submitted and then the download immediately begins without them having to take further action.
What is the code I should add to begin downloading a file after the form is successfully submitted. Here's some of the code I am currently using: