alexa-samples / skill-sample-nodejs-adventure-game

This tool provides an easy to use front-end that allows developers to instantly deploy code for your story, or use the generated code as a starting point for more complex projects.
Apache License 2.0
514 stars 219 forks source link

What does this line do? const linksRegex = /\[\[([^\|\]]*)\|?([^\]]*)\]\]/g; #68

Closed iam-Shashank closed 6 years ago

iam-Shashank commented 6 years ago

const linksRegex = /\[\[([^\|\]]*)\|?([^\]]*)\]\]/g; this is mentioned 14 times in index.js . what does it do? https://github.com/alexa/skill-sample-nodejs-adventure-game/blob/master/lambda/custom/index.js

Is this similar to displayableText = displayableText.replace(/<\/?[^>]+(>|$)/g, ""); What's the purpose of this line? this was mentioned in step 6 of Challenges in https://github.com/alexa/skill-sample-nodejs-adventure-game/blob/master/instructions/5-customization.md

gadgetchnnel commented 6 years ago

That is used to find the links between passages, by finding anything which looks like either [[link text]] or [[link text|passage name]] (the second format is what allows multiple links to go to the same passage or just for the passage name to not be the same as the link text).

franklin-lobb commented 6 years ago

@iam-Shashank did @gadgetchnnel answer your question? If not, please reopen the issue.

iam-Shashank commented 6 years ago

Yeah, answered.