By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,534 Members | 910 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,534 IT Pros & Developers. It's quick & easy.

help for regular expression syntax

P: n/a
I cannot seem to formulate what seems should be an easy expression. I need to
find all occurances of a pattern except when it contains a specific string.
For example if the string is

Dim s As String = "xmlns:b=""base"" xmlns:h=""http://www.mydomain.com""
xmlns:t=""type"""

I need to find both xmlns:b="base" and xmlns:t="type" and replace them, but
not replace the xmlns:h="http://www.mydomain.com" occurance.

using

Dim s As String = "xmlns:b=""base"" xmlns:h=""http://www.mydomain.com""
xmlns:t=""type"""
s = Regex.Replace(s, "\s*xmlns(:[^=]*)=""[^=]*""", "")

I can find an replace all, but how do I keep it from replacing
xmlns:h="http://www.mydomain.com"

thx in adv for help
Nov 17 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.