Category Archives: regular expressions

PHP: File Downloads HTTP Headers

In PHP you can provide file downloads by using a PHP page to “pass through” the file. Of course you could just link to the actual file, however this technique means your file can kept outside of your website root. Another advantage is you can integrate this system into a PHP based user/password system easily. [...]

Vim: Search and Replace, Insert new line

Vim has some really useful commands, especially search and replace ones. Unfortunately I'm always forgetting the finer details of how to use them so here's an example: PLAIN TEXT CODE: :%s/$/\rthis is a new line To break down whats happening above: : switches Vim into command mode % means we're going to apply this command [...]

SQL: Selecting Specifying Multiple Field Values

Here are 3 different ways to perform a DB select when you want to specify two or more values for a field. 1. Use th OR operator PLAIN TEXT SQL: SELECT * FROM people WHERE (first_name = 'pete' OR first_name = 'paul'); 2. Use a Regular Expression PLAIN TEXT SQL: SELECT * FROM people WHERE [...]

Email Interaction with Web Applications (using PHP, Postfix and Regular Expressions)

One of the popular facilities on phuser.com is the ability to create polls. Once a poll has been created it can be sent to people by SMS or Email. The recipients can reply with their choice of answer and a optional comment using SMS, Email or phuser web interface, lovely! Handling of emails replies has [...]