Category: Programming

All about programming (Java, for example) and scripting (like PHP, Javascript, HTML, CSS, JSON, XML and so on).

PHP Match dates which may differ a few seconds from each other

At my work, I needed to compare two CSV files containing CDR’s (Call Detail Records). To made it quick and easy, I made a PHP script to do this. Some CDR’s were missing in our file or vice versa. The CDR’s which were not missing needed to be compared with each other. The problem was …

Continue reading

Regular expression for matching URL

For a piece of software I wrote, I needed a security check which validates URLs. It needed to match any URL starting with HTTP or HTTPS, the host could be a IP or a hostname (like localhost) and it also should match port numbers (like :8080 for example) and trailing directories (/directory/anotherdirectory). Basically, it should …

Continue reading