Subject: Create Filter that accept certain html tags inText
Posted By: bekim Post Date: 10/7/2004 5:23:57 AM
Hello
I am trying to create a filter that only accepts 3 html tags like
<Br>
<B></B>
<mailto:someone@website.com>

from textbox.

How do I go about doing this?  What properties & methods should I use??

Reply By: bmains Reply Date: 10/7/2004 7:57:19 AM
I would probably lean towards using regular expressions, the Regex class in the System.Text.RegularExpressions namespace.  This class has an IsMatch shared function that checks the text against a reg exp string, and returns a boolean value.

Brian
Reply By: bekim Reply Date: 10/8/2004 3:34:15 AM
bmains,
Can you give me an brief example of IsMatch shared function that checks the text against a reg exp string of  the Regex class in the System.Text.RegularExpressions namespace.

There is no example of this in MSDN.COM.
Thanks

Reply By: bekim Reply Date: 10/8/2004 6:07:45 AM
Hello
Is there a 3rd party Assembly that already has all html tags as regular expression to use to filter textbox to validate safe html tags that I can purchase??



Reply By: bmains Reply Date: 10/8/2004 5:20:02 PM
Hey,

I don't think there is a third-party tool.  What you may want to consider is creating a custom validator control for yourself.  This wouldn't be too hard.

Regular expressions use a peculiar string of characters to match patterns.  It is really powerful stuff.  The IsMatch is a shared method that takes the input string to check, matches it against the regexp expresssion (2nd param), and returns a boolean value.

Brian
Reply By: bekim Reply Date: 10/8/2004 7:30:28 PM
I can use custom validator control to see if the textbox.Text string only allows <Br><B> and <mailto: >?  I only saw examples of custom validator that only check for one expression like email address.  Where do I go to set multiple regular expressions in custom validator control??  (Can I only do this as code behind??)


Go to topic 20405

Return to index page 749
Return to index page 748
Return to index page 747
Return to index page 746
Return to index page 745
Return to index page 744
Return to index page 743
Return to index page 742
Return to index page 741
Return to index page 740