Hi,

I would like to use nested tokens, a similar question was asked in this thread

http://www.daniweb.com/forums/thread110255.html

While this did address how to do it with a single instance, I was wondering how to do it with multiple instances in a string. ie.

input to textbox1
"I {love|like} {blue|red|orange|pink} its my {favorite|worst} color "

press a button and would output a random word in the brackets to textbox2/msgbox similar to.

"I like red its my favorite color"
or
"I love pink its my worst color"

If someone could give me example code or point me in the right direction it would be much appreciated.

>point me in the right direction.

Regular Expression (Regex class)

Dim str = "I {love|like} {blue|red|orange|pink} its my {favorite|worst} color "
str = Regex.Replace(str, "(\{|\})", "")
str = Regex.Replace(str, "((\w+)+\|)", "")
Console.WriteLine(str)

Cool, thankyou for your response.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.