Help with RegExp conversion from PhP to VB

I am transfering over a regular expresion from php to VB (I am using it to block cross site scripting on a web page)
The original php epresion is:
$string = preg_replace('#(<[^>]+)style[\x00-\x20]*=[\x00-\x20]*([\`\'\"]*).*expression[\x00-\x20]*\([^>]*>#iU',"$1>",$string);

My VB version using RegExp
regex.Pattern = "#([a-z]*)[\x00-\x20]*=[\x00-\x20]*([\`\'\""]*)[\\x00-\x20]*j[\x00-\x20]*a[\x00-\x20]*v[\x00-\x20]*a[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iU"
oldstring = regex.Replace(oldstring, "$1=$2nojavascript...>")
(note I replaced the single apostrophe with a double)
I get a very unhelpful error from VB:
Application-defined or object-defined error

Two questions:
What is wrong with my pattern?
How do I get more helpful error messages out of RegExp?
thanks
Phil

philgggAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

pradapkumarCommented:
Please try this

regex.Pattern = "#([a-z]*)[\x00-\x20]*=[\x00-\x20]*([\`\'\" & chr(34) & chr(34) & _
    "]*)[\\x00-\x20]*j[\x00-\x20]*a[\x00-\x20]*v[\x00-\x20]*a[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iU"


I hope this will help u.
0
mvidasCommented:
Hi Phil,

I noticed your 3rd block of hex 0-20 has two \ symbols, that should only be one:
 [\\x00-\x20]

To:
 [\x00-\x20]

The rest of it looks syntactically correct at least.
Matt
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.