Answer the question
In order to leave comments, you need to log in
How to select phone numbers from a string?
Good afternoon! I ask for help to remove unnecessary from the output to php
The output is
Channel: Exten: CLCID: ========================================================================================== Channel: PJSIP/739-00009cf3/Dial Up 00:01:15 Exten: s CLCID: "CID:9622088888" <79379853222> Channel: PJSIP/814-00009cf5/Dial Up 00:00:25 Exten: s CLCID: "CID:9622088888" <89119120799> Channel: PJSIP/BEELINE_9622088888-00009cf4/AppDial Up 00:01:13 Exten: CLCID: "" <9622088888> Channel: PJSIP/BEELINE_9622088888-00009cf6/AppDial Up 00:00:25 Exten: CLCID: "" <9622088888> Objects found: 4
Answer the question
In order to leave comments, you need to log in
https://regex101.com/r/qVEDaP/1
PJSIP/(\d+)\S+ Up ([\d:]+).+?<(\d+)>
$str = '
Channel: Exten: CLCID: ========================================================================================== Channel: PJSIP/739-00009cf3/Dial Up 00:01:15 Exten: s CLCID: "CID:9622088888" <79379853222>
Channel: PJSIP/814-00009cf5/Dial Up 00:00:25 Exten: s CLCID: "CID:9622088888" <89119120799>
Channel: PJSIP/BEELINE_9622088888-00009cf4/AppDial Up 00:01:13 Exten: CLCID: "" <9622088888>
Channel: PJSIP/BEELINE_9622088888-00009cf6/AppDial Up 00:00:25 Exten: CLCID: "" <9622088888>
Objects found: 4
';
preg_match_all('~PJSIP/(\d+)\S+ Up ([\d:]+).+?<\K\d+~s', $str, $m, PREG_SET_ORDER);
print_r($m);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question