Archive for the tag 'php'

Aug 11 2008

Finding tag through regex

Published by Gaurav Mishra under programming

I am saving this for my reference , A post with all commonly used regex, first one to go is finding <img> tag through php using regex.
$pattern = ‘/<img[^>]+src[\\s=\'"]‘;
$pattern .= ‘+([^"\'>\\s]+)/is’;
if(preg_match($pattern,$subject,$match))
{
echo $match[0];
}

One response so far

Aug 02 2008

Correct .htaccess structure

Published by Gaurav Mishra under programming

Usually we all get very greedy while making our url structure using .htaccess
For example, This will not work as you think
RewriteRule ^(.*)/$ category/categories.php?cat=$1 [L,QSA]
RewriteRule ^(.*)/(.*)/$ category/categories.php?cat=$1&name=$2 [L,QSA]
This will not work as after first rewrite will write , the current url structure will change to www.mydomain.com/<something>, Which will result to the last rewrite rule to be [...]

No responses yet

May 30 2008

Running smarty on shared hosting

Published by Gaurav Mishra under programming, web

Just needed to install and make ready smarty for a small project, Was thiking of again going to official howto when i stumbled to a very nice “For dummies” article for putting smarty out of box http://tinyurl.com/5py5o8
Nice work dude.

No responses yet

FireStats icon Powered by FireStats