RegEx expression help

J

Julie

I'm an admitted regex moron, but I need help w/ an expression for parsing.

Here is the input string:

(123.45)ABC(44.55)

with a regex expression of

\(|\)

Regex.Split outputs the following:

""
"123.45"
"ABC"
"44.55"
""

This is fine, however I don't want (need) the leading and trailing "" -- what
do I need to add to the regex expression to get just:

"123.45"
"ABC"
"44.55"


Thanks
 
M

Michael Bray

I'm not sure this is the absolute answer, but I believe this is the
expected output when using Regex.Split (as opposed to using Regex
matching mechanisms). Just iterate over the results and check for
equivalence to string.Empty.

-mdb
 
J

Joep

....or you might exclude the leading and trailing brace from the input to
split...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top