eregi to preg


Posted on 16th Feb 2014 07:03 pm by admin

Im converting my regex for php 5.3 and I am stuck on the following

Code: [Select]if((eregi("<[^>]script*"?[^>]*>", $secvalue)) ||
(eregi("<[^>]*object*"?[^>]*>", $secvalue)) ||
Did you know?Explore Trending and Topic pages for more stories like this.
(eregi("<[^>]*iframe*"?[^>]*>", $secvalue)) ||
(eregi("<[^>]*applet*"?[^>]*>", $secvalue)) ||
(eregi("<[^>]*meta*"?[^>]*>", $secvalue)) ||
(eregi("<[^>]style*"?[^>]*>", $secvalue)) ||
(eregi("<[^>]*form*"?[^>]*>", $secvalue)) ||
(eregi("<[^>]*img*"?[^>]*>", $secvalue)) ||
(eregi("<[^>]*onmouseover*"?[^>]*>", $secvalue)) ||
(eregi("<[^>]body*"?[^>]*>", $secvalue) && !eregi("<[^>]tbody*"?[^>]*>", $secvalue)) ||
(eregi("([^>]*"?[^)]*)", $secvalue)) ||
(eregi(""", $secvalue)) ||
(eregi("forum_admin", $sec_key)) ||
(eregi("inside_mod", $sec_key))) {
block_ip($blocker_row);
}

anyone got any ideas on how to convert this to preg.so far I have this

Code: [Select]$html_regex = '{
^(
(?: <scriptb[^>]*>.*?</script> # script block
| <objectb[^>]*>.*?</object> # object block
| <iframeb[^>]*>.*?</iframe> # iframe block
| <appletb[^>]*>.*?</applet> # applet block
| <metab[^>]*>.*?</meta> # meta block
| <styleb[^>]*>.*?</style> # style block
| <formb[^>]*>.*?</form> # form block
| <imgb[^>]*>.*?</img> # img block
| <onmouseoverb[^>]*>.*?</onmouseover> # onmouseover block
| <bodyb[^>]*>.*?</body> # body block
)*+
)$
}isx';
if (preg_match($html_regex, $html_string))
No comments posted yet

Your Answer:

Login to answer
227 Like 48 Dislike
Previous forums Next forums
Other forums

PHP and SMS
Hi all forum members. I am new here and am unsure what category shoild I post this in.
Moderator

Function
How can I make this function that once you click the link in the code it takes you to a new page wit

How to display random record from table?
I have the following code:

Code: <?php
$display_block .= "<input type=

$_GET problem
Hi all,

Have a bit of a problem with a little piece of code, I am not sure if this should be

INSERT for date range
Hi all

I have the following table

Code: [Select] `date` date
`day` int(2)
`

removing space from the end of a variable
i have a variable $image which contains the following url "http://tiles.xbox.com/tiles/oo/P5/0m

Multi language - seo links
Im trying to figure out the best method to have a multi language website that will function with seo

help need on ob_start()
Hi

I am a newbie in php, I have a code
Line number On/Off | Expand/Contract <?phpo

Calling a Procedure with IN & OUT Parameters
Hello,

I usually call my procedures using the following way

declare variable e

php redirecting
i wont open a new thread but i have a question about redirecting....
i wonder why my code doesnt

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash