generic cialis
Home » Archive

Articles in the Regular Expressions Category

PHP, Regular Expressions »

[24 Sep 2009 | No Comment | ]

Problem
I have a ton of date strings in the stupid US style dd/mm/yy format. i.e. 12/24/09 being 24th September 2009. I need to convert them to the UK style dd/mm/yy.
Solution 1
As a string in PHP is really just an array of characters, the simplest fix was to address the individual number characters by their positions within the sting, and rearrange them into the format I wanted:

$d = “12/24/09″;
$d = $d[3].$d[4].”/”.$d[0].$d[1].”/”.$d[6].$d[7];
echo $d; // displays “24/12/19″.

Solution 2
I posted my solution on twitter (@hutchings) and asked for comments and @londonhackspace organiser Jonty came …

Regular Expressions, Textpad »

[10 Dec 2008 | 8 Comments | ]

Textpad is a great editor, been using it for years, but never really used it to it’s full potential. Recently I needed to do some find/replace work in some huge SQL and CSV files – huge enough to make manual editing impossible – so I had to start using Textpad’s Regular Expression capabilities.
Here are a few expressions that came in handy. I intend to add to this list as time goes on.
Regexp shown in Green, my comments in Red.
CSV Editing:
Remove spaces and tab characters at the beginning of a line:
Find …