regular expressions to look for specific series of character
Moderator: General Moderators
regular expressions to look for specific series of character
I am not sure the best way to ask this, but how can regular expressions be used to validate that a field entry does not include <> </> html tags, etc? The field entry would be rather random and can include - and /
Thanks for the advice.
Thanks for the advice.
feyd | Please use
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]Code: Select all
if($str === html_entity_decode(strip_tags($str)))
{
// Doesn't contains tags
}
else
{
//Does contain tags
}feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]well it should help in my case...i mean i am still going to receive the unwanted emails from the form, but te links will be removed(hopefully)....I need to think of a way to validate the fields before the email is sent...I wonder if I could create an array of keywords to block the email from being sent out.
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
I don't see why you can't just use htmlspecialchars()