Мне нужна помощь для извлечения части "BODY" из строки в соответствии с двумя следующими случаями:
Случай 1:
Var1 =
Content-Type: text/plain; charset="UTF-8"
BODY
--000000000000ddc1610580816add
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
BODY56 text/html
--000000000000ddc1610580816add-
Случай 2:
Var1=
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
BODY
--000000000000ddc1610580816add--
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
BODY56 text/html
--000000000000ddc1610580816add-
Я хочу сделать:
, если Var1 содержит: Content-Type: text/plain; charset="UTF-8"
, затем извлечь текст между Content-Type: text/plain; charset="UTF-8"
и --000000000000ddc1610580816add
, если Var1 содержит:
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Затем извлеките текст между:
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
И --000000000000ddc1610580816add--
.
моего кода, мне нужно исправить это, если кто-то может это исправить:
if (index($body, "Content-Type: text\/plain; charset=\"UTF-8\"\n
Content-Transfer-Encoding: quoted-printable") != -1) {
$body =~ /Content-Type: text\/plain; charset="UTF-8"\n
Content-Transfer-Encoding: quoted-printable(.*?)--00.*/s ;
$body=$1;
}
elsif (index($body, "Content-Type: text\/plain; charset=\"UTF-8\"") != -1)
{
$body =~ /Content-Type: text\/plain; charset="UTF-8"(.*?)--00.*/s ;
$body=$1;
}