Jump to content

Regex Wont Match


ionik

Recommended Posts

Heres my problem

 

I need to match this

 

Link : text

 

Description : text

 

as a array with the link => text and description => text as two separate arrays

 

I am using preg_match

 

like this

<?php
$string = 'Link : http://link.com Description : Some information Here!!';
preg_match('/Link : (.*?)/is', $string, $matches1);
print_r($matches1);
preg_match('/Description : (.*?)/is', $string, $matches2);
print_r($matches2);
?>

 

why isnt this working ?

 

the output of this is

 

Array
(
    [0] => Link : 
    [1] => 
)
Array
(
    [0] => Description : 
    [1] => 
)

Link to comment
https://forums.phpfreaks.com/topic/112267-regex-wont-match/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.