Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    ASP & have generously sponsored dedicated servers and web hosting to ensure a reliable and scalable dedicated hosting solution for

Filter Bad Words Using Regexp

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 Complete Forum Thread with Replies
Sponsored Links:

Related Messages:
RegExp For URL
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
RegExp Gods
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[.

Set oMatches = oReg.Execute(sHTML)

For Each oMatch In oMatches
sHTML = Replace(sHTML, oMatch.Value, "")

View Replies !   View Related
Vbscript RegExp
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]......
......<img src="/mydir/pics/my%20portrait.jpg " alt="A picture of me">.....

View Replies !   View Related
RegExp Experts
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
RegExp Question
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
RegExp Question
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 = "
" = True
catchCR = regQuote.Replace(strText, "<br>")

View Replies !   View Related
RegExp :: BB Code
I have a bit of code that replaces all links in my forums with hyperlinks. I'd like to add []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
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 !   View Related
RegExp Question
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
Do You Have Your Own RegEXp To Validate Your String
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
Problems Using The RegExp Object
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
Post Code Regexp
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
Evaluate RegExp To True.
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
Regexp To IGNORE Html
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
REGEXP Uppercases And Double Quotes
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
Random GUID Type Number Or RegExp
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:

Would this be reated with RegExp? And how?

View Replies !   View Related
How To Highlight Words
let's say that I want to highlight some words or even a square of a table in would i go about doing that? What code would work to do what I need?

View Replies !   View Related
How To Display The Value In Words?
I'm having a problem in displaying a selected option from the drop down list in words. But after I selected an option, nothing is being displayed, I think the value can't be passed at all. Please let me know how to fix it.

<td align=center width=20%>Fruit:
<select name=""FruitName">
" If not myRS.eof Then
while not myRS.eof
<option value="<%=myRS.fields("ID")%>"<%If FId = myRS.fields("ID") Then response.write "selected"%>><%=myRS.fields("FName")%></option>

<p>The fruit you have selected is <%=FruitName%></p>

View Replies !   View Related
Trimming Words
I have a database field that is a memo type. I would like to be able to only display the first 50 words from the database. I would like for it to show ..... after about 50 words.

I am using <%=Content %>. How do I trim this field to show only 50 words and then ....?

I tried the following code:
Function LengthTrim(input, length)
If Len(input) > length Then
Return Left(input, length) + "..."
Return input
End If
End Function

then <%= LengthTrim(Content, 50) %>

But it would not work. I got the following error message:

Microsoft VBScript runtime error '800a01f4'Variable is undefined: 'Return' .

View Replies !   View Related
Separate Two Words
I have data where first and last name are in one field. I need help
how to i separate first and last name in ASP.

View Replies !   View Related
Spaces Between Words
the spaces between the words (in a textbox for example) are removed when i try to pass the value to another page for saving.

View Replies !   View Related
Retrieve Words
I want to take a string like this:Code:


and retrieve only the words over a certain length or longer (let's say 5 characters), maintaining spaces between them- result:Code:


View Replies !   View Related
Replacing Whole Words
i am having trouble getting my REPLACE fn. to replace whole words only. basically, i'm running a 'spelling checker' fn. that uses the REPLACE fn. to find incorrect spellings and replace them. problem is, the fn. seems to replace all instances of a string, and not a whole word only as I intend it to be:

Code as follows:

StrInput = Request.Form("BKM_Search")
StrInput = LCase(StrInput) 'convert all to lowercase
StrInput = Trim(StrInput)'trim all empty space b4 & after string
StrCorrect = Replace(a_StrWrong, a_StrRight,1,1,1)

Let's say I want to replace the word "sea" with "ZZZ" only:

Example input: "Sean has some neat sea shells"
Example output: "ZZZn has some neat ZZZ shells"

View Replies !   View Related
Add Words To Dictionary
I have to develop a spell checker from scratch using asp language. as i'm a newbie with asp, there are still a lot of things that i don't understand. How can I add new words to my list of dictionary sorted alpabetically?

Do i need to use the database for this function? Can anyone show me? or if anyone knows of any websites that i can refer to.

View Replies !   View Related
Words In A String
Let's say I have the following var:


strTemp="Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed"

and I am searching the string for another string 'amet', for example. How would I go about getting my page to output the word I search for and say 10 chars to the left and 10 to the right? So, in this case, I'd like to be be able to search the string with any
other string ['amet' for example] and have it output this:


...dolor sit amet, consecte...

View Replies !   View Related
ASP Filter
Ive written some ASP code to list information from a table in my database.. what i need is a drop down list to list all the regions (provided by a table called tblRegion), and when the region is selected that re-queries the list.. Code:

View Replies !   View Related
I've got a website that I've been making some changes too as of late. It's not my website so I've been learning a lot, especially since I'm fairly new to coding and webdesign. So keep in mind, I'm just a newb. If there's not enough info here to allow anyone to help, just say so and I'll figure it out on my own. Here's my problem...

This site I'm working on has all kinds of directories and allows certain people within a company to upload files to certain directories. I've got a .asp file that shows all of the content providers for all directories in a table.

I want to make it so that in my directorylist.php file there's a button that will allow a user to click on this "View Content Providers for this Directory" button and it will read/filter this asp file, and spit out a list of only the users who have authority to upload files to that particular directory that the user is looking at.

Is there some way to link the two files to do that? Or is it just a change I need to make in the loop in the asp file or perhaps a change in the php file? I'll provide a piece of code from the .asp file. Code:

View Replies !   View Related
On my page i run a SQL query that selects certain records from the database,
Is there any way to select a specific record from the recordset then another one. e.g. say i run a SQL that picks up all records with ID < 30 and then i want to pick one with an ID of 1 and then one with an ID of 4 without re-running the SQL query?

View Replies !   View Related
.filter Using MID
I had an sql statement like 'WHERE MID(id,4,1) = 3' but when I try to use the filter method it returns the error:

'Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.'

rs.filter = "MID(id,4,1) = 3"
Thats what its supposed to look like right

View Replies !   View Related
I've used Rs.Filter several time sin my code and they all work fine. However when I use


Rs.Requery adAsyncExecute
Rs.Filter = DateDiff("n",lastedit,NOW) < 15

I get
ADODB.Recordset error '800a0bb9'

Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another. Am I typo'ing something or can I just not use DateDiff in a filter?

View Replies !   View Related
Highlight Returned Words
wondering if its possible to have some kind of searched word highlight! IE. every thing it throws up in return of search it will highlight why it has brought it up! so if search "a" all "a" in return results would be highlighted.

View Replies !   View Related
COutn The Number Of Words
how can i count how many words have i written in a text
area?Like taking an example ... i am writing in this textarea
of microsoft usergroup. and say in total i have written 50
words .. how can find out this information?

View Replies !   View Related
Words After Blank Space
I retrieved some data from the database and put it in a textbox but the words after the blank sapace cannot be shown, why is that?
Name = rs("requestor") 'where the name is "Sam Siew"

<TD><INPUT TYPE=TEXT Name=requestor size=12 Value=<%=Name%>></TD>

In the text box, it only show "Sam".

View Replies !   View Related
Capitalise All Words In A String
how to capitalise all words in a string that are seperated by spaces. The string is variable and not the same every time hence I cant use the Ucase function as I wont know the exact position of the start of each word.

View Replies !   View Related
Display Words Meanings
I would like to have a text box where people can type a word they want and then click on a button to get the description of that word.The way I see it working is if the word they entered in the box is in my database a page will display the meaning corresponding to the word in the database. However if it is not then it will display a message telling them that.

View Replies !   View Related
Highlight A Section Of Words Only
This code highlights words entirely. I look for the word nation it highlights words like abomination. So I only want the function to highlight whatever I'm looking for. Code:

View Replies !   View Related
Bold Search Words
i have a form where the user keys in words to be searched from the itemDescription column in the database. My search works fine, but how to i bold that particular searched word?

View Replies !   View Related
Highlight Words Of A Search
I'd like to add to my search function of my asp site the possibility to highlight in the result pages all the words searched.

View Replies !   View Related
Multiple Search Words
I have a small form which searches a SQL DB on several fields - ie.

WHERE Field1 = xxx AND Field2 = xxx AND Field3 = xxx

How can I do this so that if one search criteria is left blank, it ignores it instead of trying to match it in the DB?

View Replies !   View Related
Transform Say 12,000 (number To Words)
how can i transform say 12,000 to "twelve thousand" with asp?

View Replies !   View Related
Length Of Words In A String
I'm really at wits end on this as I'm not having much success with locating a function or other options I have. I'm working on a message board for a website and I'm needing to check the length of the words that users put in.

For example, when someone puts in "yesssssssssssss!", I put together a small function that omits all of the s's as this is wreaking havoc on the layout of tables within the site. But I don't have a solution if someone types in "ssss sasdfjskldjfaskld;jfaskdf" as random ambiguous letters.

I know I can check the length of the entire string but don't know to check the words
within it.

View Replies !   View Related
Displaying The First Two Hundred Words
How do i use asp to retrieve the first two hundred words from a field in a database.

View Replies !   View Related
Count The Number Of Words
how can i count how many words have i written in a text area? Liek taking an example ... i am writing in this textarea of devshed forumns. and say in total i have written 50 words .. how can find out this information?

View Replies !   View Related
Numbers (currency) To Words
I have found a lot of VB on numbers to words, can this also be done in ASP? Would like to convert a formated currency output to words.

View Replies !   View Related
SQL And Month Filter
I am trying to get my SQL Query to to through a list of faults, and pull all the records from the previous month (say now is july(7) it pulls all from june (6)

the current SQL i have is....

SELECT Faults.DateAdded, Faults.[Teacher ID], Faults.[Computer ID], Faults.[Type of Fault], Faults.[Description of Fault], Faults.Fixed
FROM Faults
WHERE ((Month([DateAdded])=Month([Date])-1));

but this doesn't work, can anyone assist?

View Replies !   View Related
Filter Criteria
I'm using APS VBScript web page on an Access2000 database and I am trying to select from a recodset using a date as the criteria.
I keep getting ADODB Data Type Mismatch errors no matter what I do to the database field (which hold a date/time) or the URL.
My URL looks something like ... result.asp?id='3/20/2005'...
The database field is an Access date/time field formatted to mm/dd/yyyy.

View Replies !   View Related
ISAPI Filter
Isapi is installed and rules are working. Now I have to change the links of my shopping cart from dynamic to url friendly.
How can I change the internal links of my cart in an automatic manner (some script maybe)? I am trying to avoid to go trhought the proces of 'seach and replace'.
I know it is possible to do it in PHP with one scripf for each kind of friendly url link. I am wondering if this can be done in ASP, better said, if the scripts are already done ready to adapt as I am not a coder.

View Replies !   View Related
Distinct Filter
I have information in a database with the following structure:
3 Divisions - each division has several districts. Each district has several regions and each region has several areas.
I have a recordset of every area with the region, district and division they belong to.
I have 4 drop down menus on my page - area region, district and division.
How can I filter my recordset before each dropdown, so it only has DISTINCT records

View Replies !   View Related
Asp+Filter Database
How do I create an asp page that searches two tables in my database. I want to create a page with multiple drop down lists which a visitor selects to filter my database results. For example a visitor can select to search the database for products with COLOR red and SIZE large - or COLOR black and SIZE small - How do I do this? Is it complicated because I am new to this ASP lark

View Replies !   View Related
Filter Members
I want to dynamicaly filter the members in my pivottable.
Here you see how it's done the static way:

pview.RowAxis.InsertFieldSet pview.FieldSets("manager)
Set fld = pview.FieldSets("manager").Fields(0)
fld.FilterFunction = c.plFilterFunctionInclude
fld.FilterMembers = Array("ZWAENEPOEL Geert","VAN COILLIE Caroline")

but I receive the selected members from another page, they are all in
the field 'selectedmembers', so I tried this:

fld.FilterMembers = Array(selectedmembers.value)

View Replies !   View Related
Filter Problem
i have recordset rs on that i am applying filter as:

rs.Filter = " PRCD = '"&product&" ' and HQ_NAME='"&hqs"' "

here,PRCD is Column of datatype varchar(20)
HQ_NAME is Column of datatype varchar(20)

the problem is with PRCD,if substitue value directly as :

PRCD='SLO1NMK' filter is working but PRCD = '"&product&" '
not working.where as HQ_NAME='"&hqs&"' is working individually fine

View Replies !   View Related

Copyright 2005-08, All rights reserved