我正试着从几个小时开始。下面是字符串。
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
,我们需要这些值。
答案 0 :(得分:1)
来往或来自:(To|From): ["0-9<:@.>;a-zA-Z:=]+
获取内容长度:Content-(l|L)ength: \d+
答案 1 :(得分:0)
To\:\s(.*)|From\:\s(.*)|Content\-Length\:\s(.\*)
您将获得$ 1 $ 2 $ 3的数据
答案 2 :(得分:0)
这是使用积极前瞻的另一种方式:
(?=To|From)\w+:\s"(\d+)"|Content-Length:\s(\d+)
$1
将包含您的到和来自值
$2
将包含 Content-Length 值
您可以尝试HERE