I am trying to use Javascript to parse text that has been entered into a text field that would combine many user variables to create random actions. This may make more sense by looking at an example. As an example, you can specify:
Activity
@Home
@Out
@Home
Read @book for @time
Clean up @room for @time
@Out
Eat at atrestaurant
@book
Enders game
Lord of the rings
@room
bedroom
garage
basement
@restaurant
Red robin
Mcdonalds
Starbucks
@time
15 minutes
30 minutes
45 minutes
60 minutes
Pound / and signs will be used to separate the different categories.
Then the result will be determined randomly from this input, for example:
"Eat at Starbucks." or "Read the Lord of the Rings for 60 minutes." or "Clean the garage for 30 minutes."
Is this doable? It sounds like it should be pretty simple, but I don't know where to start. Any suggestions?
Thanks,
Albert
javascript parsing
Albert
source share