Jump to content

Preg_match problem


sastro

Recommended Posts

here the script

<?php
$a='dir/5_cat/big-dog.html
dir/0_cat/wild-dog.html
dir/1_cat/expensive-dog.html
dir/3_cat/expensive-cat.html';

$b='dir/1_cat/expensive-dog.html';
$th=str_replace(array('.','/'),array('\.','\/'),$b);
if(preg_match('/'.$th.'/',$a)){
echo 'found';
}else{
echo 'not found';
}
?>

 

It works if

$b='dir/1_cat/expensive-dog.html';

but result still found with

$b='dir/1_cat/expensive-dog.htm';

 

Please help

Link to comment
https://forums.phpfreaks.com/topic/219156-preg_match-problem/
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.