1

正如我从几个小时开始尝试的那样。下面是字符串。

Contact: <sip:6185347017@202.65.142.187:54163>
To: "915454454544"<sip:915454454544@103.24.124.2>
From: "6185347017"<sip:6185347017@103.24.124.2>;tag=8237b810
Call-ID: OTNhYzMxZDFmOThmMGI1ZmIxNmE3OGM2MGZkOTFkZTc.
CSeq: 2 INVITE
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
Content-Type: application/sdp
Proxy-Authorization: Digest     username="6185347017",realm="103.24.124.2",nonce="5f69d948-0639-11e3-8d11-238fc92f6fd0",uri="s      ip:915454454544@103.24.124.2",response="39a1d1688114ec06d5ccd49bba1b4883",cnonce="3c76312b0377    9cdf9c9aa4d3f2a1962a",nc=00000001,qop=auth,algorithm=MD5
User-Agent: eyeBeam release 1102q stamp 51814
Content-Length: 315

我想获得To:价值和From:价值content-Length,我们需要这些价值。

4

3 回答 3

1

去往或来自:(To|From): ["0-9<:@.>;a-zA-Z:=]+
获取 Content-Lengh :Content-(l|L)ength: \d+

于 2013-08-16T08:32:39.907 回答
0

这是使用积极前瞻的另一种方法:

(?=To|From)\w+:\s"(\d+)"|Content-Length:\s(\d+)

$1将包含您的ToFrom

$2将包含您的Content-Length

你可以试试这里

于 2013-08-16T09:02:20.640 回答
0
To\:\s(.*)|From\:\s(.*)|Content\-Length\:\s(.\*)

您将在 $1 $2 $3 中获得您的数据

于 2013-08-16T08:34:28.887 回答