Jump to content

Recommended Posts

Posted

This snippet works perfectly for nested spintax:

However, I can't figure out how I can write a function that will output all the permutations of nested spintax.

For example: for a string "John went to the {{grocery |}store|library}" I would get:

John went to the library

John went to the store

John went to the grocery store

...

I can't figure this out - - I can kinda figure it out if there isn't any nesting (regex out all the text between brackets)...but nesting makes it pretty complicated for me to wrap my head around :)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...