Tarek Saied
Tarek Saied

Reputation: 6626

need a Regular expression to split string

I need a Regular expression that allows me to split the following string in c#:

Product Name : product name some text adfasd asdfas Quantity : 1 Base Price : 999.00

Vendor Product ID : text-text-text-text

to get this result

text
text
text
text

the "-" is repeated from 2 to 5 times

note : this pattern is part of big pattern so i cannot use string.split

i try this (-?(.+?)?-?(.+?)?-?(.+?)?)\s

Upvotes: 1

Views: 71

Answers (1)

MarcinJuraszek
MarcinJuraszek

Reputation: 125660

How about ([a-zA-Z]+)(?:-([a-zA-Z]+)){0,3}

Upvotes: 2

Related Questions