var str = "Subject: qqq
\nName: qqq
\nEmail:
[email protected]
\n
\nsdfadf"
{"ScriptPreparationCode":"var str = \u0022Subject: qqq\u003Cbr /\u003E\\nName: qqq\u003Cbr /\u003E\\nEmail: 1@test.ru\u003Cbr /\u003E\\n\u003Cbr /\u003E\\nsdfadf\u0022","TestCases":[{"Name":"regex","Code":"const regExp = /Subject: (.*)\u003Cbr \\/\u003E\\nName: (.*)\u003Cbr \\/\u003E\\nEmail: (.*)\u003Cbr \\/\u003E\\n\u003Cbr \\/\u003E\\n(.*)/gim;\r\nconst result = regExp.exec(str)\r\nconst subject = result[1];\r\nconst name = result[2];\r\nconst email = result[3];\r\nconst description = result[4];","IsDeferred":false},{"Name":"for","Code":"const data = str.split(\u0060\u003Cbr /\u003E\\n\u0060);\r\n\r\nlet subject;\r\nlet name;\r\nlet email;\r\nlet description;\r\nlet ticket;\r\n\r\ndata.forEach(item =\u003E {\r\n const subjectTitle = \u0022Subject: \u0022;\r\n const nameTitle = \u0022Name: \u0022;\r\n const emailTitle = \u0022Email: \u0022;\r\n\r\n if(item.indexOf(subjectTitle) !== -1) {\r\n subject = item.slice(subjectTitle.length);\r\n }\r\n\r\n if(item.indexOf(nameTitle) !== -1) {\r\n name = item.slice(nameTitle.length);\r\n }\r\n\r\n if(item.indexOf(emailTitle) !== -1) {\r\n email = item.slice(emailTitle.length);\r\n }\r\n\r\n if(\r\n (item.indexOf(subjectTitle) === -1) \u0026\u0026\r\n (item.indexOf(nameTitle) === -1) \u0026\u0026\r\n (item.indexOf(emailTitle) === -1) \u0026\u0026\r\n (item !== \u0022\u0022) ) {\r\n description = item;\r\n }\r\n});","IsDeferred":false}]}