aamirbabar 0 Newbie Poster

Hi:

Hello everybody:

I need to parse the form field, say Description. I want to disallow all the html tags but anchor text. Basically i need a pattern that will match 0-9 a-zA-Zm -, _, @ and anchor text (can be multiple occurance). So if the text in description form field match this criteria, i will allow the user to submit the form successfully otherwise validatiion will fail.

examples:

Valid input
-----------
My name is john doe. i live in xyx, city xyn state.
I am a technial recruiter. my web site is <a href="xyx.com"> john doe</a>
Please visite. my phone number is 000-000-7777. My email is x@y.com
My Work website is <a href=xyz.com> work website</a>

Invalid Input
-------------
My name is john doe. i live in xyx, city xyn state.
&lt;img src=cby.com&gt; or &lt;script&gt;&lt;script
I am a technial recruiter. my web site is <a href="xyx.com"> john doe</a>
Please visite. my phone number is 000-000-7777. My email is x@y.com

Need help with regular expression

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.