Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cassandra/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 用于分析多部分/混合体的正则表达式_Javascript_Regex_Multipart - Fatal编程技术网

Javascript 用于分析多部分/混合体的正则表达式

Javascript 用于分析多部分/混合体的正则表达式,javascript,regex,multipart,Javascript,Regex,Multipart,我想要一个javascript正则表达式来解析多部分/混合体。例如,在以下情况下: 这是一条包含多个MIME格式部分的消息 --frontier Content-Type: text/plain This is the body of the message. --frontier Content-Type: application/octet-stream Content-Transfer-Encoding: base64 PGh0bWw+CiAgPGhlYWQ+CiAgPC

我想要一个javascript正则表达式来解析多部分/混合体。例如,在以下情况下:

这是一条包含多个MIME格式部分的消息

 --frontier
 Content-Type: text/plain

 This is the body of the message.
 --frontier
 Content-Type: application/octet-stream
 Content-Transfer-Encoding: base64

 PGh0bWw+CiAgPGhlYWQ+CiAgPC9oZWFkPgogIDxib2R5PgogICAgPHA+VGhpcyBpcyB0aGUg
 Ym9keSBvZiB0aGUgbWVzc2FnZS48L3A+CiAgPC9ib2R5Pgo8L2h0bWw+Cg==
结果应为以下字符串的数组:

 [**"Content-Type: text/plain
 This is the body of the message."**,

 **"Content-Type: application/octet-stream
 Content-Transfer-Encoding: base64
 PGh0bWw+CiAgPGhlYWQ+CiAgPC9oZWFkPgogIDxib2R5PgogICAgPHA+VGhpcyBpcyB0aGUg
 Ym9keSBvZiB0aGUgbWVzc2FnZS48L3A+CiAgPC9ib2R5Pgo8L2h0bWw+Cg=="**]

我试图找到一种方法,使用正则表达式,不执行loop@user292167:你为什么要这样做?正则表达式似乎是这个工作的错误工具。那你为什么不直接做内容分割呢?