Hello, I made a video parser from YouTube and there is in the description of phone numbers and skype tell me a regular expression or how to parse phone numbers

in international number format

plain text

For any questions please contact, call: Skype: aigul_ar77 Tel: +77027637790

  • in international number format - Petro Boyko
  • Of course the decision if I can don’t know how to do it - Petro Boyko
  • Well, publish the source line at least in your question. UPD: ideally, you should provide not only the source line, but also your solution, in which you had difficulties, and describe these difficulties. And you came without anything, and even the source did not bother to publish. Such questions here quickly bypass and close. - Edward
  • I don `t know what to write don` t know where to start - Petro Boyko

1 answer 1

номер: $str = 'hghg +7(903)888-88-88 hgghg'; preg_match('/((\+?\d+[\s\-\.]?)?((\(\d+\)|\d+)[\s\-\.]?)?(\d[\s\-\.]?){5,6}\d)/x', $str, $number); echo $number[0]; // +7(903)888-88-88 скайп: $str = 'По Всем вопросам пишите, звоните: Скайп : aigul_ar77 Тел : +77027637790'; preg_match('/[a-zA-Z][a-zA-Z0-9\.,\-_]{5,31}/i', $str, $skype); echo $skype[0]; //aigul_ar77 
  • Is it possible to parse Skype? - Petro Boyko
  • one
    @Petro Boyko added in response - Solo_777
  • tell me how to make the URL clickable in instagram $clean_desc = str_replace('~@(\S+?)\s~', "https://www.instagram.com/\$1", $clean_desc); - Petro Boyko
  • it does not work out like this so it’s a parsi from the text and if so it makes passes ~ (\ + [\ d] +) ~ - Petro Boyko
  • it seems to be decided like this: preg_match("~(\+[\d- ()]+)~",$a,$m); $c = $m[1]; preg_match("~(\+[\d- ()]+)~",$a,$m); $c = $m[1]; - Petro Boyko