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

Need Regular Expression Help

P: n/a
I want to parse the following string into 3 parts per match. I almost got
it, but my expression has a flaw in it.
I tried this, but didn't quite work the way I expect on the second match b/c
there's no space before the symbol.

<§\s(.*?)\s*;?\s(.*?)\s*>(.*?)</§>

You must<§ Control.exe; Printers>add a printer</§from the <§
Control.exe>control panel</§>.

Anyone know of a good forum to goto for help with regular expressions?

Thanks,
Lee
Jul 28 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
this is a xml like structure. try to parse this using xml.

"Lee Grissom" <lee dot grissom at quest dot comwrote in message
news:%2***************@TK2MSFTNGP05.phx.gbl...
>I want to parse the following string into 3 parts per match. I almost got
it, but my expression has a flaw in it.
I tried this, but didn't quite work the way I expect on the second match
b/c there's no space before the symbol.

<§\s(.*?)\s*;?\s(.*?)\s*>(.*?)</§>

You must<§ Control.exe; Printers>add a printer</§from the <§
Control.exe>control panel</§>.

Anyone know of a good forum to goto for help with regular expressions?

Thanks,
Lee

Jul 28 '06 #2

P: n/a
Hi Lee,

This is one of my favorite references on Regular Expressions:

http://msdn.microsoft.com/library/de...geElements.asp

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Magician

A man, a plan, a canal.
a palindrome that has gone to s**t.
"Lee Grissom" <lee dot grissom at quest dot comwrote in message
news:%2***************@TK2MSFTNGP05.phx.gbl...
>I want to parse the following string into 3 parts per match. I almost got
it, but my expression has a flaw in it.
I tried this, but didn't quite work the way I expect on the second match
b/c there's no space before the symbol.

<§\s(.*?)\s*;?\s(.*?)\s*>(.*?)</§>

You must<§ Control.exe; Printers>add a printer</§from the <§
Control.exe>control panel</§>.

Anyone know of a good forum to goto for help with regular expressions?

Thanks,
Lee

Jul 28 '06 #3

P: n/a
I found that http://www.regular-expressions.info is a good reference.

So I came up with this expression, which works according to Regex Coach
http://weitz.de/regex-coach
But it throws an exception at runtime in C#.

<§\s+(.*?)\s*(?(?=;);\s*(.*?)\s*|(?))>(.*?)</§>

You must <§ Control.exe; Printers>add a printer</§from the <§
Control.exe>control panel</§>.

Still trying to figure it out.
--
Lee
Jul 29 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.