• Guide to regular expressions

  • A “regular expression” (or regex) essentially is the use of a pattern for string manipulation.

    Regular expressions are used in many scripting and programming languages as they are a very powerful tool, allowing you to match and replace strings based on the supplied pattern.

    Regular expressions aren’t always that simple, however there are things you can do to make it as easy as possible.

    Some people, when confronted with a problem, think “I know, I’ll use regular expressions.” Now they have two problems.

    Jamie Zawinski, in comp.lang.emacs

    • If you can use native string functions instead, use them. Regular expressions should be your last port of call.
    • Don’t be lazy, TRY.
    • Read about what regular expressions actually are on Wikipedia.
    • Don’t reinvent the wheel, you may find the solution is already out there, google for it or try the Regular Expression Library.
    • Read Mastering Regular Expressions by Jeffrey Friedl. This book is not only a story, but its also a good resource for examples and reference.
    • Testing regular expressions?
      • The Regex Coach is a tool that comes highly recommended for testing your patterns.
      • Try the Regex Powertoy, it’s a fantastic AJAX based matching tool.
      • RegExR – a FREE desktop application for Mac, Linux and Windows.
      • RegexBuddy – Not free, but meant to be good.
      • For Python there’s Kodos.
      • Your favourite scripting language. PHP, Perl, Javascript, TCL, MRC, VBS, almost any of them!
    • Cheat Sheets make good references, there is one at and
    • Regex in Javascript?
    • In PHP PCRE regex is quicker than EREG, but you should always see if you can use quicker native functions such as strncasecmp, strpbrk and stripos instead.
    • For performance reasons it is recommended that you should always try and use the native functions instead of regex, especially in PHP.
    • Stop parsing HTML with regexes and read how to parse HTML.
    • When parsing XML in PHP try xml2array, which makes use of the PHP XML functions, for HTML you can try PHP’s DOM document or DOM XML in PHP4. Also try Simple HTML DOM Parser.
    • Try getting help, if you do, tell us:
      • What goes in?
      • What do you want out?
      • Which language are you using?
      • Have you tried anything yet?

    Hope this helps!

  • Migrating from Windows to Linux

  • These days I find myself playing less and less games on my computer. This is mainly because I use my computer as a workstation, and playing games would interfere with that.

    My workstation, like most runs Microsoft Windows – Why? – Because I always have done.

    With the release of Windows Vista ever dawning, and the new Windows Genuine Advantage checks, there has never been a better time to find an alternative solution.

    Over the past few years I have had more and more dealings with Linux, and I find myself asking the same question… “What is stopping me from migrating from Windows to Linux?”, I then find myself creating all kinds of excuses why I cannot.

    I spent many months attempting to eliminate these excuses, by offering the solutions to your problems.

    My reason for sharing this with you is to make it more of a realistic possibility for everyone, not just IT gurus or geeks, but anyone.

    Why would I want to migrate?

    There are many reasons why you would want to migrate, I’m sure that the reasons to migrate out weigh the petty reasons of why you are forced to stay on windows.

    • Affordable – Not only is it that Windows costs a lot of money, but the additional software you require, such as Microsoft Office costs money too! Using Linux and Open Source software eliminates these costs, as they are freely available for download.
    • Reliable – This is the reason why a large percentage of the worlds websites run on Linux based servers, and not windows.
    • Secure – It’s not that it doesn’t have its fair share of issues, its that its not targetted in the same way as windows, meaning that there are a fraction of the problems.
    • Compatible – Anything runs on Linux. Almost.
    • Support – Linux has been very well received over the years, therefore there is much support behind any Linux related project.
    • Future – Is it really a realistic idea that people will pay for an operating system when they can get one for free that can do exactly the same things. Certainly not, therefore this is the future.
    • Choice – One of the best thing about Linux is that there is a vast choice of distributions that all offer their individual advantages. No longer are you forced to purchase an operating system from one distributor, you can simply download it free from your choice of distributors.
    • Anti-monopolisation – Microsoft have had it too easy for too long, holding a large percentage of the workstation market, give them a reason to really get competitive.
    • Privacy – By running windows and connecting to the internet, you are seriously compremising your privacy, Microsoft now checks your OS Version, System Manufacturer, System Model, Windows Product Key, the date, and most likely your IP address will be logged, as this is standard protocol when you access a server.
    • Open Source – No more closed source non-sense like the software from Microsoft.

    There are the reasons to migrate, and i’m sure you’ll agree, they are good enough reasons.

    Usually at this point you will find excuses of why you can’t migrate, usually along the lines of “My [essential software] will not run on linux”.

    I intend to look at each piece of “essential software” people use on Windows and offer either a way to run it on Linux or a compatible alternative.

    We all have them, software we use on a day-to-day basis that we’d seriously miss if they no longer existed.

    My essential software is as follows:

    • Microsoft Outlook (NOT Outlook Express) – This offers Mail, Calendar, Contacts, Tasks, Notes and Journal, I mainly use Mail, Calendar and Contacts.
    • mIRC – An internet relay chat client that is second to none, not because of its interface, but because of its flexable scripting ability, its very useful to create an automated function to achieve a certain repetitive task. It also obviously allows me to chat to certain people and and within communities.
    • Winamp – There’s nothing better than streaming or playing mp3s from my vast collection of music.
    • Mozilla Firefox – Possibily the best browser around at the moment.
    • Outlook Express – A very simple mail client and newsgroup reader, I personally don’t use outlook express, as I use Outlook, but I imagine the usenet part is essential to some people.
    • Mozilla Thunderbiard – A reasonable alternative to Outlook Express.
    • FileZilla FTP Client – A rather good open source ftp client, an absolute must for uploading and downloading to/from an FTP server.
    • EditPlus – A really useful text editor, so much better than Notepad.
    • MSN/Live Messenger – I need to beable to communicate with my mates.
    • RealVNC – Important peice of software to allow me to access my PC from anywhere, mainly for access to mIRC and Outlook, but mainly because i’m very often out and about.
    • Photoshop – I like to have a dabble sometimes…
    • Azureus – Bit Torrents are big thing these days, you’re gonna need a good bit torrent client.
    • Microsoft Word – Everyone needs a good word processor, after all, this is why computers were made.
    • Microsoft Excel – Spreadsheets are very useful for displaying tabular data, and creating graphs.
    • Microsoft Access – I know that often people use access for their database systems, although I don’t use it myself, I know its very important to some people.
    • Nero – A great peice of software for making backups, burning images and duplication.
    • PowerDVD – Its nice to beable to play DVD’s on your PC, especially when your PC monitor is bigger than your TV
    • Audiograbber – So when I do actually buy a Music CD I like to convert it into mp3s so I can listen to it without the CD in my drive.
    • Dreamweaver – Its not that important, but its useful sometimes to have a WYSIWYG HTML editor or web authoring software.
    • Putty – The ability to connect to a server via SSH is vital as a server administrator.
    • X-Lite – A peice of SIP Voice Over IP software, very useful in this day and age, especially when people are calling you.
    • Calculator – I don’t physically have a working one, a software one is very useful.
    • Adobe Acrobat Reader – An important peice of software for reading PDF files.
    • Norton Antivirus – I left Mcafee many years ago for Norton, we all need a way to stop those little critters!
    • Kerio Personal Firewall – Godda block those unwanted connections.
    • Winzip and Winrar – Having some kind of compression and more importantly decompression utility is important.
    • Apache – I actually run a local copy of Apache with PHP, usually as part of XAMPP for local development purposes and remote file access.
    • File and Printer Sharing – Although its actually part of windows, i’d seriously miss the ability to access files across my network.

    I got this far, my next step was to look at Linux alternatives to this software, however this is where my migration plan breaks down, as I lack research on a solution to Microsoft Outlook in Linux.

  • Finding a Portal Script

  • I spent a long time today searching for a PHP based portal script either for a small community website or an ISP.

    What I am looking for as a small community is a basic version of what offers or similar.

    What I am looking for in an ISP community website is a basic version to what (formerly wanadoo/freeserve) offers or similar.

    My theory was that something like this would exist already, after all there’s no point re-inventing the wheel, or at the very least I would be getting a feel for what was already out there.

    So I began looking in all the normal places, starting with, where I found nothing decent. I then began looking on where there is an entire directory just for PHP portals.

    I soon discovered that the majority were either PHP-Nuke based or PHP-Nuke like, which is NOT what I am looking for, others were basically a CMS package, not a portal.

    Eventually I came across a portal called Creative Community Portal, which looks like it would be perfect for the small community website so I take a look. I’m taking to a website called Creative Software. They are offering this script at $79.99, however I soon realised that these guys aren’t the best at web design, yet it strikes me as odd that they have quite a tidy portal script on offer, my assumption was that they had taken it from somewhere else, and so my research begins.

    I began by trying to find other sites that use the same engine by searching for the names of the images, and common strings.

    I find the following websites:


    The first thing you should notice is that they all appear to be in different programming languages, and none of them use the same design as the one I found originally, yet they are all closely matched. I figure there must be some kind of third party code generating software being used.

    So I take a look at the HTML code of some of the sites.

    Its not long before I find this:

    So I decide to take a look at YesSoftware CodeCharge v3.0.1.6, and I believe I am onto a winner as I find that an example script bundled with the software is infact a portal! And as if that wasn’t enough I found mention on their forums of an online portal which can be downloaded from for free.

    The problem I found is that none of these look anything like the sites above, let alone the site I found originally. The search continues.

    I go back to looking for similar sites.

    Its not long before I find this:

    On this site I find more details, including a user guide, license agreement, and more importantly the name of the company that made it, UltraApps. However, when I visit their website, there’s no mention of this application. Never fear though, there’s always the web archive.

    The rabbit hole deepens.

    I soon find myself on their old website, via the web archive looking at downloading their portal script, there it is, you can download it for free. I download the PHP version and have a play around with this for quite some time. I find two problems, firstly this does not offer all the features that the Creative Software version does, and secondly it doesn’t appear to login for some strange reason.

    I go back to the UltraApps web archive, and discover there is another version, which is the Portal Enhanced Edition, which is NOT free, you must purchase this at a price of $50. I figure I have come to the end of the road with this as without paying somebody some money I’m not getting it for free, and as such UltraApps don’t appear to offer it any longer, and Creative Software doesn’t actually have the right to be selling it in the first place.

    So as I begin to close down my windows, I notice something strange on the Creative Software “demo” site, the title says: “My USA City Guide”, this strikes me as odd, as their demo is a UK version.

    After a quick search I find this demo, which appears to owned by the creators of the style/theme, yet appear to be using the UltraApps code.

    I gave this some thought, and I soon realise that this begs some questions:

    • Why does UltraApps no longer offer their portal?
    • Is there an issue with selling applications produced by YesSoftware Code Charge?
    • Does the USA City Guide have the rights to resell the UltraApps product?
    • Does Creative Software have the right to resell the USA City Guide product?

    Further more I found that the Creative Community script had some major vulnerabilities.

    And after all that I have no decent portal script for a basic small community website.

    The only half decent thing I found was called phpFoX, and by a look at the demo, its simply a clone of MySpace, which is NOT what i’m looking for. Despite the fact that it’s expensive.

  • eTicket

  • For the past few weeks I have been mostly working on eTicket.

    eTicket is an open source Support Ticket System based on osTicket.

    The reason eTicket exists is because no further development has occurred on osTicket since 2005, and unfortunately there were some major flaws found in osTicket.

    Over time, many users of osTicket reported many of the known bugs onto the osTicket Forums, this made it very easy to figure out what the problems were and how to overcome them.

    I myself had discovered some issues with osTicket and already coded some solutions. With this in mind I decided to take on osTicket as my own, and add the appropriate fixes and modifications.

    There were some restrictions with working on eTicket from osTicket, this was the database structure. This is due to the fact that I understood that one of the most important things to users was that they would want to upgrade from osTicket to eTicket, the easiest way of achieving this was to keep the database structure the same and simply changing the files.

    eTicket is now at the point where there are no known problems or bugs, the only issues that remain are features that require changes to the database structure (such as additional tables).

    I hope to continue working on eTicket indefinitely.

  • Getting your mobile unlocked

  • I get asked quite often if I know how to get a mobile phone unlocked, so this is my experience…

    I was given a Motorola V525 as the original owner had an upgrade. They are on the vodafone network, and I am on O2.

    When I put an O2 simcard in the phone it asked me to “Enter Subsidy Password” (other phones may say “Enter Special Code”), I tried a few random numbers (probably about 15 by the time I had finished), and the phone locked up. Displaying the following: “Contact Service Provider”, and it will not go away.

    However, there is a solution I found at:

    Q: I keep getting the following prompt on my Motorola after I insert another sim card “Contact Service Provider” ?

    A: That means wrong unlock code has been entered already!

    (This message appears after many wrong subsidy or special code entry)

    Power on phone and wait between 30 min to 8 hours till Enter Subsidy or Special Code

    message appear again! (Please note that phone should be powered on during this time).

    I left it turned on, and charging over night, and came to it the following day, it asked me for the unlock code.

    After reading this forum I discovered that you CANNOT unlock the Razr V3, or V525 or any other Motorola simply by providing someone with your IMEI code.

    As far as I can see there are only THREE ways around this:

    1. You need a datacable (~$10) and MotoPhoenix ($25) — It seems this guy here has achieved it using a datacable and some choice software…

    2. Contact your phone carrier/operator or service provide (O2, Orange, Vodafone, T-Mobile, etc) and ask them for the unlock code, like this guy did.

    They will ask you for the following details:

    Mobile Telephone Number:

    Customer Account Number:

    Full Name:

    Full Address:

    Date of Birth:




    1. The third way involves using buy methods, such as buying from ebay, or, but as these methods are completly untested (by me), and they don’t tell you how it works, I wouldn’t advise them.

    I used method 2, and after a few emails back and forth, and a phone call from the previous owner, I was provided with 2 unlock codes and told that one of them would work.

    I have since then used the same method again with Vodafone ([email protected]) for a Motorola V3X, this time I simply put a request for the unlock code, and provided them with the details (as above), within 3 hours I had a reply from them, as follows:


    Good Afternoon Mr. XXX,

    Thank you for your email to Vodafone about the network unlock code (NUC) you requested. I'll be happy to assist. Your NUC is as follows:



    I hope this information is of use. Please contact me if you require any further assistance.


    Best wishes,

    Neil Breeze
    Vodafone Customer Services

    This worked no problems, so I sent an email back to them congratulating them on their quick response, which makes a change.

subscribe via RSS