Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
 
Python, Lua, Tcl, C and C++ training - public course schedule [here]
Private courses on your site - see [here]
Please ask about maintenance training for Perl, PHP, Java, Ruby, MySQL and Linux / Tomcat systems
 

Well House Consultants
You are on the site of Well House Consultants who provide Open Source Training Courses and business hotel accommodation. You are welcome to browse and use our resources subject to our copyright statement and to add in links from your pages to ours.
Other subject areas - resources
Java Resources
Well House Manor Resources
Perl Resources
Python Resources
PHP Resources
Object Orientation and General topics
MySQL Resources
Linux / LAMP / Tomcat Resources
Well House Consultants Resources
Extras Resources
C and C++ Resources
Ruby Resources
Tcl/Tk Resources
Web and Intranet Resources
Object Orientation and General technical topics module Q806
Regular Expression Cookbook
Exercises, examples and other material relating to training module Q806. This topic is presented on public course Regular Expressions



Related technical and longer articles
Regular Expressions in Java

Articles and tips on this subjectupdated
3788Getting more than a yes / no answer from a regular expression pattern match
Guy walks up to me in the street and asks "Could you direct me to the Town Centre?". So I answer him "yes, I could", and walk on. Does he thank me? No - he probably thinks "what a useless half answer" or "how rude can you be", even though I completely and correctly answered his question. It's sometimes ...
2012-07-14
 
3218Matching a license plate or product code - Regular Expressions
Questions from my mailbox: 1. Regular expression to accept the following form of license plate numbers. Three letters followed by between 1 and 4 digits. 2. A regular expression to accept the following product codes: Between 1 and three characters (in capitals) followed by between one and three digits. OK ...
2011-03-28
 
2804Regular Expression Myths
Does this look good to you?   /.*\S+[@]\S+.*/ It shows some regular expression myths that I would like to explode! Myth 1. If you want to match a specific character, you must put it in square brackets. WRONG ... Square Brackets are a grouping - if you're looking to match just a single specific ...
2010-06-18
 
2727Making a Lua program run more than 10 times faster
I made an extraordinary claim on Thursday. One of my delegates had written a program that analyzed a huge data file in a Lua script, and it was taking over half an hour to run. "Give me five minutes, and I could have that running in less that five minutes" I claimed. It was all to do with pattern ...
2010-05-14
 
2702First and last match with Regular Expressions
Conventional Wisdom says that it's pointless to start a regular expression with ".*" or ".+", as this is implied within a match - regular expression matches are looking for strings that are contained anyway: '/abc/' - contains abc '/.*abc/' - contains anything or nothing, followed by abc However - ...
2010-04-02
 
2608Search and replace in Ruby - Ruby Regular Expressions
"If you want to replace one part of a string by another in Ruby, you can use the sub method on your string object. The first parameter you give to the method is the string you want to replace, and the second is the string you want to replace it by." OK - that's the easy bit ... but what if .... If ...
2010-02-01
 
2563Efficient debugging of regular expressions
Are you a programmer? Have you ever spent *hours* looking for a very odd bug in your code that, when you find and fix it, turns out to have been so blindingly obvious that you ask "why sis it take me so LONG" ... and so does the boss! The good news is that - if the boss is a programmer - (s)he will ...
2010-01-04
 
2165Making Regular Expressions easy to read and maintain
Have you ever seen a long regular expression made up of so many special characters that you can't read or maintain it very easily? Something like /\(\s*([A-Z]{4})\s+(\d+(?:\.\d*)?)\s*\/\s*(\d+(?:\.\d*)?)\s*\/\s*(\d+(?:\.\d*)?)\s*\)/ We offer a Regular Expression Course that will help you understand ...
2009-05-10
 
1840Validating Credit Card Numbers
It's standard practise for on line bookings these days to take credit or debit card details as a booking security, and we're no exception at Well House Manor - our hotel for business visitors to Melksham, Wiltshire. There are very many security issues involved, and I am not going to describe what we ...
2008-10-14
 
1305Regular expressions made easy - building from components
There seems to be a certain macho desire in many programmer's minds to write a single complicated regular expression to match against an input line, ignorning the structured approach that everyone accepts quite cheerfully in almost every other case. Have a look at this Python line: wholeline = r"\d\d-...-\d\d\d\d\s+(\d\d):(\d\d):(\d\d.\d\d),\s+(-?\d+\.\d+),\s+(-?\d+\.\d+),(-?\d+\.\d+),\s+(-?\d+\.\d+),(-?\d+\.\d+),\s+(-?\d+\.\d+)" Impressive, ...
2007-08-16
 
1230Commenting a Perl Regular Expression
The x modifier on the end of a Perl regular expression causes all spaces in the regular expression to be treated as comments (rather than matching exactly). This means that you can lay out your regular expressions much more cleanly. And wherever you're allowed white space, you can add comments from ...
2007-06-13
 
672Keeping your regular expressions simple
There's something macho about programmers when it comes to regular expressions - so often they'll try and do the whole job in a single regular expression when doing a two stage process is much more logical, much quicker in operation, and far easier to code. Take a requirement that came up this morning, ...
2006-06-05
 
Examples from our training material
easier.py   making regular expressions easier to read [Python]
ex1.php   Regular Expressions in PHP - from simple yes/no to ancilliary responses
Background information
Some modules are available for download as a sample of our material or under an Open Training Notes License for free download from [here].
Topics covered in this module
Options for caputured output
Matching the parts of the string you don't want
When to use .* on the start of the end of a match
Using Regular Expressions to handle numbers
Other Regular Expression engines - from vi to Expect
Complete learning
If you are looking for a complete course and not just a information on a single subject, visit our Listing and schedule page.

Well House Consultants specialise in training courses in Ruby, Lua, Python, Perl, PHP, and MySQL. We run Private Courses throughout the UK (and beyond for longer courses), and Public Courses at our training centre in Melksham, Wiltshire, England. It's surprisingly cost effective to come on our public courses - even if you live in a different country or continent to us.

We have a technical library of over 700 books on the subjects on which we teach. These books are available for reference at our training centre.


You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2017: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/resources/Q806.html • PAGE BUILT: Mon Feb 8 18:55:24 2016 • BUILD SYSTEM: WomanWithCat