RegExp Code?
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:
View Replies
ADVERTISEMENT
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.
View Replies
View Related
Some one has kindly supplyed me with this regexp to check all UK post codes:
/^([Gg][Ii][Rr] 0[Aa]{2})|((([A-Za-z][0-9]{1,2})|(([A-Za-z][A-Ha-hJ-Yj-y][0-9]{1,2})|(([A-Za-z][0-9][A-Za-z])|([A-Za-z][A-Ha-hJ-Yj-y][0-9]?[A-Za-z])))) [0-9][A-Za-z]{2})$/
The trouble is it looks for a space in the middle and i DONT want a space.I can't see the bit that does this
View Replies
View Related
I am looking for a REgExp (or function) that will check a URL is entered in correctly
View Replies
View Related
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>"
View Replies
View Related
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
View Replies
View Related
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">.....
View Replies
View Related
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.
View Replies
View Related
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?
View Replies
View Related
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>")
View Replies
View Related
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:
View Replies
View Related
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.
View Replies
View Related
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.
How would I do it? O, here's the way it is now:
<%= Decode(ChkBadWrds("Comment")))%>
How would I do something similar using regexp?
View Replies
View Related
I am trying to use the RegExp object to alter a string by a specifec pattern.
my string will be something simillar to this:
str = "bla bla <p> another bla <p class='row1'> bla"
I want the pattern that I give the RegExp object return all the "p" tags, that meens, in this example, "<p>" & "<p class='row1'>".
I wrote this code in ASP but the required results are not returning: Code:
View Replies
View Related
How do I evaluate a RegExp to true or false? Like I want to know if the value is correct or not using this snippet. Code:
View Replies
View Related
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
View Replies
View Related
I'm trying to solve three minor problems with vbscript REGEXP.
1) I want to find any occurences of and|or|not in a string and capitalize them.
regEx.Pattern = "(s)(and|or|not)(s)"
KW = trim(regEx.Replace(KW, "$1" & ucase("$2") & "$3"))
how come this is not working?
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.
regEx.Pattern = "(^|s|[^a-z0-9])" & highlitetemp(iTemp) & "(s|$|[^a-z0-9])"
Body = trim(regEx.Replace(Body, "$1<span class=highlite>" & highlitetemp(iTemp) & "</span>$2"))
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?
View Replies
View Related
I have used:
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?
for example:
4515-81301-75454-45136-1
Would this be reated with RegExp? And how?
View Replies
View Related
I'm looking for sample code that will require a use to enter a code from a scued image format.
I'm sure you've seen them before where the image is barely readable by a human and the user has to enter the code correctly to submit the form.
I'm looking for ASP code and NOT ASP.NET code as I am supporting a legacy site.
View Replies
View Related
do you know of any asp code that makes a pdf on the fly.
if there's none do you know of a good, not-so-expensive and easy-to-implement component?
View Replies
View Related
Is there any way that I can store my ASP code in an Access DB and have it display that way? Ideally, I would like to make a page with a text area that I can write and edit code in, and then when I submit it, I would like to view the page that the code creates. The code in the DB would include code that selects from and updates the DB.
I would like to do this because I can't work remotely now.
View Replies
View Related
What is wrong with my code?
This is the error.
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'CLASSDATE >= 6/23/2004 ORDERBY CLASSDATE'.
This is the code.
Code:
strSQL = "Select * FROM WellClass WHERE CLASSDATE >= " & DATE & " ORDERBY CLASSDATE"
View Replies
View Related
I am trying to follow the W3Schools tutorial on the XMLDOM object, and it works fine in a regular HTML document inside <script> tags (vbscript), but I am trying to do it in the ASP tags (<% %>) and it does not work.
The error says:
Code:
Microsoft VBScript runtime (0x800A01A8)
Object required: '[object]'
View Replies
View Related
I am trying to do something with it and I can figure out what to do!I have created a database that lets realtors track clients, potential clients, and offers made. Here is a link to the database:(URL address blocked: See forum rules)
What I am trying to do is create a form that lets a user enter his first name, last name, email, and offer amount into textboxes. When they click send it adds their information to the Potential Buyer table (the primary key is an auto generated number.) The offer table is basically an associative table, containing the following information: buyer$buyerid, client$clientid, and amount. I would like the amount to be added to this table, and I would like it to also add the newly created buyerid. My problem is that well, I have no idea how to do this, as the buyerid is created only seconds before I need to post it in the offer table. Could anyone help me out with this? I'd really appreciate it.
View Replies
View Related
Im a novice with ASP and no idea of PHP, can Any one help me convert this to ASP...
$rss = $_GET['rss'];
if ($rss && $rss != ""){
if ((strpos($rss, "http://") === 0) || (strpos($rss, "https://") === 0)){
readfile($rss);
}
}
View Replies
View Related
Here's the current code that I'm using for navigation through some pages. MY question is, I want the item "System-Add Ons" to still stay bolded if I'm on a page that's in a subset of "Products" Is this possible?
For example, if a user gets to the page "Monitors," (monitors.asp) I want System-Add Ons to stay bolded....
How can I set up subsets of the "Products" page? Do I have to make a directory and do a test if the page is in the directory "Products" and is affiliated with "Products?" Code:
View Replies
View Related
how to get the content or information of other web site using asp code.
View Replies
View Related
is there any way in asp to execute a pop-up window when a condition in an if statement is satisfied
View Replies
View Related
I Wanna to know that which of below codes related to
ADO within ASP (VBscript) is better?
CODE ONE ::
rsEduCalender.CursorLocation=3
With rsEduCalender
if .State=1 then .Close
.Open SQLstr,cn,3,1
End With
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''
CODE TWO::
With rsEduCalender
if .State=1 then .Close
.CursorLocation=3
.Open SQLstr,cn,3,1
End With
View Replies
View Related
figure out what the ASP code is to email a form?
View Replies
View Related
i created ASP page for Online TEST
it Consist three pages
First Page is Selection of Topic and Number of Questions from List Box.
Second page is shows the Questions as per the Selection in previous page Datas from the Database.
Third Page is Result Page.
But My problem is in Second Page, because all the question are created dynamicaly so that how can i get the User answer
I get the question id and correct answer for all the questions.
but i need to get the user answer for Result.I attached my code for the second page.
View Replies
View Related
Is there a program or website that will validate my asp pages?Kind
of like how html pages can be validated on
http://www2.imagiware.com/RxHTML/ and on http://netmechanic.com
View Replies
View Related
this is what i am doing for zip codes
i want user to enter zip codes like this
92274
92274-0965
so if the user enters zip code like this 92274 then its right
but if he enters zip codes like this 922740965 then change it to 92274-0965
this is what i have done so far so i have got the values of first 5 i need to include a -and then the rest of the numbers any idea how to make this work
View Replies
View Related