Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
For 2023 - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))

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 Q803
Regular Expressions - Extra Elements
Exercises, examples and other material relating to training module Q803. This topic is presented on public course Regular Expressions

As well as matching a pattern, a regular expression can be used to filter out part of a string. This is a very powerful feature, but then you'll also need to learn about capture brackets, sparse and greedy matches, modifiers and more.

Articles and tips on this subjectupdated
3650Possessive Regular Expression Matching - Perl, Objective C and some other languages
"I'm looking to spend between £200,000 and £225,000 on a new home" you say to the salesman and - guess what - you're offered something much nearer £225,000 that £200,000. With Regular Expression matching, you can ask the question "do we have a match", and that returns a Yes / ...
3516Regular Expression modifiers in PHP - summary table
PHP's ereg functions are deprecated, and you should now be moving to the preg functions. See [here]. As you're switching your PHP code from ereg to preg regular expressions, you'll be adding delimiters to the main regular expression and providing the ability to add modifiers onto the end - a series ...
3100Looking ahead and behind in Regular Expressions - double matching
Look-ahead and look-behind are a way of "double matching" in a regular expression. If you're at a certain point in the match and you think "the next bit should conform to xxx and at the same time it should conform to yyy" then you can describe xxx via a look-ahead, and follow that with matching yyy ...
3089Python regular expressions - repeating, splitting, lookahead and lookbehind
If you're looking for part of a string that's repeated again later in the string, you can capture the first occurrence and then use a back reference (\1, \2 etc) to refer to "same again". In Python, you can also name the element that you want to repeat - examples [here]. If you have a number of fields ...
2909Be gentle rather than macho ... regular expression techniques
Please don't be "macho" with your regular expressions. You can write a very long and complex pattern to match something like a postcode or email address, but if you do, it's be hard to test, difficult to debug, and awkard to maintain. And to add insult to injury, it will probably run slower that the ...
1860Seven new intermediate Perl examples
From the "learning to program in Perl" course I'm running this week, I am pleased to present seven new examples ... written during the course, in front of the delegates, to show them NOT ONLY how the code works, BUT ALSO how a programmer will develop such code. Lists and Context * If you use an @abc, ...
1735Finding words and work boundaries (MySQL, Perl, PHP)
If you're searching for the word "mile", you probably don't want the page that tells you that Sally Smiled at Harry. But you may want to find a Milestone, even if it is within quotes. Regular Expressions are your friends! In Perl style regular expressions (which also work in Python, and in PHP with ...
1613Regular expression for 6 digits OR 25 digits
I can write a regular expression to match ANY number of digits between 6 and 25 ... ^[[:digit:]]{6,25}$ but how would I write a regular expression to match either 6 digits or 25 digits, but no number in between? ^([[:digit:]]{6}|[[:digit:]]{25})$ (The regular expressions in this example are Tcl and ...
1601Replacing the last comma with an and
If I have a list, I'm likely to want to present it comma separated for the most part, but with the word "and" between the last two elements. "Cambridge, the M11, the M25, the M4, the A361 and Melksham" for example. Lists or arrays can be joined in almost any language with a function called join or ...
1372A taster PHP expression ...
I've been working on RSS feeds ... looking to get a page that combines various blogs so that I can have a quick look and see where we stand without having to hop and skip round each in turn. And with magpierss, it's turned out to be quite easy. Yet some blogs give a summary in the their RSS feeds - ...
1336Ignore case in Regular Expression
Do you want to ignore case in a regular expression? There are a variety of ways of doing it ... depending on the language you're writing. Here are some hints: /abcd/i Perl - an i after the regular expression eregi PHP - use eregi rather than ereg re.I or re.IGNORECASE Python - extra parameters ...
943Matching within multiline strings, and ignoring case in regular expressions
Regular Expressions are powerful matching tools and you can specify almost anything within them. But there are certain facilities that are naturally applied to the regular expression as a whole rather than to parts of the match, and there are specified in a different way in each language / implementation. For ...
Examples from our training material
ahead   Negative look ahead
bref   Back References
isbn   Testing validity of ISBN number, including check digit
lazyvgreedy.py   Comparison of Greedy and Sparse [python] ...
lookahead.py   Negative lookahead - does not consume / must fail to match [Python]
lookbehind.py   Negative lookbehind - fail if you have just passed over [python]
pcode   Perl - match and extract from a postcode
pocohunter   Post Code hunter / Perl
posso   Sparse, Greedy and Possessive matching
Background information
You may download this module as a sample of our material
Topics covered in this module
Capturing matches.
Which match?.
Sparse matches.
Look around, ahead, behind.
Ignoring case..
Global matching.
Modifiers that fine tune individual regular expression elements.
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., 2023: 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.info/resources/Q803.html • PAGE BUILT: Sun Oct 11 14:50:09 2020 • BUILD SYSTEM: JelliaJamb