开发者

Node.js: Regular Expressions to Parse 'Content-Type'

开发者 https://www.devze.com 2023-02-25 17:22 出处:网络
Given the text below: --2vEsE.4eBcGncL7.1Tvsnl.7yygwPC content-type: text/plain; charset=\"utf-8\" Content-Transfer-Encoding: quoted-printable

Given the text below:

 --2vEsE.4eBcGncL7.1Tvsnl.7yygwPC
content-type: text/plain;
    charset="utf-8"
Content-Transfer-Encoding: quoted-printable

XXXX

--2vEsE.4eBcGncL7.1Tvsnl.7yygwPC
content-type: message/delive开发者_Go百科ry-status

YYYYY

--2vEsE.4eBcGncL7.1Tvsnl.7yygwPC
content-type: message/rfc822

ZZZZZ

--2vEsE.4eBcGncL7.1Tvsnl.7yygwPC--

What's the best way to get a new string with the text "XXXX" and another for "YYYYY" and "ZZZZZ"? That text is every changing, what I need is to get to the position between one content-type and the other content-type.

Thanks


You can use text.split("--2vEsE") for your solution.

0

精彩评论

暂无评论...
验证码 换一张
取 消