1
Question related to how to remove only part of the text that is after my tags p:
and r:
I am developing an application similar to chatbot simsimi and for test questions I am storing the questions and answers in a var within the script. So that the bot can learn new questions and answers, I’m trying to create a command where the user would send the question and answer through the use of tags p:
and r:
as in the example below:
Example:
var text = "p: pergunta r: resposta"
For this I would have to take only the content inside my tags but do not know how to do it. Via .indexOf()
I even tried but I don’t know how to limit what he picks up until the beginning of the next tag.
if it is like in the example, if it is in a scenario where you do not know how it will arrive (with words before p:) it is best to cut the string
– Rodolfo .Freire
to solve this I created an if where it would only be accepted if the order were p: and r: respectively, where the p: would have to be at the beginning of the message.
– Jonathas Andrade