Regular Expression Help
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Regular Expression Help

From: <applemonster100@yahoo.co.uk>
Date: Tue Jul 05 2005 - 17:29:46 CEST

I have an xml string which I need to remove certain <error> node from.
I can recognise the <error> nodes I want to delete from their
attributes. For example, I need to replace the following with a blank
string :

<error errorid="11" itemid="10">The card name is mandatory.</error>

I can't use a regular expression which matches the whole <error> node
string because the text value of the node can be in french, german,
anything, or even just worded differently from customer to customer.
All I can rely on is the <error> tag and the two attributes - so this
is how I need to match.

I want to use a regular expression to remove this node but I can't get
an expression which will select the whole <error> node regardless of
the text in the node. I have tried this :

<error errorid=""11"" itemid=""12"">.*</error>

but this removes all <error> nodes from the match onwards.

Any ideas?

Thanks
Received on Tue Oct 18 02:52:04 2005