954,174 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Nested Tokens ?

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.

pablo989
Newbie Poster
3 posts since Jan 2010
Reputation Points: 10
Solved Threads: 0
 

>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)
__avd
Posting Genius (adatapost)
Moderator
8,647 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 

Cool, thankyou for your response.

pablo989
Newbie Poster
3 posts since Jan 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You