Javascript 用于分析多部分/混合体的正则表达式
我想要一个javascript正则表达式来解析多部分/混合体。例如,在以下情况下: 这是一条包含多个MIME格式部分的消息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
--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:你为什么要这样做?正则表达式似乎是这个工作的错误工具。那你为什么不直接做内容分割呢?