website tracking
Logo
Japan
 
My Photo
Name: James Pearce
Location: Perth, WA, Australia

Powered by Blogger

When using Perl style regular expressions in PHP, the preg_match function takes the whole pattern with delimiters as the pattern argument. E.g. you pass the string "/matched/" as the pattern. So this means, in theory, you can use match modifiers like this: "/matched/i" for case insensitive matching.
Now, when I was doing some regex work in PHP I had a string that contained multiple matches. I knew this, but it was only storing the first match in the $matches array. In Perl, this would be because you need to enable the global match modifier: "/matched/g". But the g modifier is not valid in PHP. What you need to do to obtain the same behaviour in PHP is use the preg_match_all function instead of preg_match. This enables the global match modifier.
I had some issues today with remote network shares in Mac OS X, when browsing sometimes the finder does not refresh the listing properly (something to do with caching). Now, in Windows, Pressing F5 will force a refresh. Mac OS X doesn't do this. I knew the file I wanted was there, because I could see it in the terminal. I didn't want to eject the volume either since I was currently working on it. What I found, is that creating a new folder or file in the directory will force the Finder to refresh that directory.