Training, Open Source Programming Languages

This is page http://www.wellho.net/resources/T247.html

Our email: info@wellho.net • Phone: 01144 1225 708225

 
For 2023 (and 2024 ...) - 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))
Tcl/Tk module T247
Advanced Regular Expressions
Exercises, examples and other material relating to training module T247. This topic is presented on public courses Learning to program in Tcl, Tcl Programming, Tcl Programming

Regular expressions are considerably enhanced in recent versions of Tcl, and this module, which assumes some prior knowledge of basic regular expressions, goes into advanced features such as groupings, sparse and greedy counts, and the Posix standard groups.

Related technical and longer articles
Pattern Matching - a primer on regular Expressions

Articles and tips on this subjectupdated
4205Regular Expression Substitution - Tcl
regexp matches regular expressions in TCL, and it will return the latest match into a series of variables if you specify their names. regsub matches and replaces... not quite such a common requirement, and perhaps something I haven't blogged about in the past.   set newstory [regsub blue $original ...
2013-11-16
 
1412Sparse and Greedy matching - Tcl 8.4
Problem Analysis Once you have done a sparse or greedy count, all your following counts will also be sparse or greedy - this is a well documented bug in Tcl 8.4! Reminder ... .* is a greedy match - any character and AS MANY AS POSSIBLE .*? is a sparse match - any character but AS FEW AS POSSIBLE set ...
2011-03-01
 
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 ...
2008-04-16
(short)
1410Tcl / regsub - changing a string and using interesting bits
Regexp matches a string to a regular expression, and regsub goes one further in that it replaces the found string with something else, saving the transformed output into a new variable. But what if I want the output pattern to include part of the string that was matched? I can refer to the "interesting ...
2007-10-30
 
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 ...
2007-09-07
 
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
 
1195Regular Express Primer
Over the years I've been teaching people about Regular Expressions, I've learnt what does and doesn't work in such tuition. A casual question I saw yesterday got me writing, and I've just posted up a new technical article to the solution centre - see here (it will open in a separate window). It's ...
2007-05-21
 
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 ...
2006-11-26
 
Examples from our training material
T247.tcl   Tcl in use for CGI scripting
aretest   advanced regular expression match demo
blob   Progressive regsub examples
sparkle   Sparse v Greedy regular expressions
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
Introduction.
What are advanced regular expressions?.
The working of a regular expression.
The elements of a regular expression.
Literal characters.
Assertions.
Character groups.
Counts.
Extensions.
A little more on regexp and regsub.
A further example.
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 Tcl/Tk, Expect,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.


© WELL HOUSE CONSULTANTS LTD., 2024: 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.net/resources/T247.html • PAGE BUILT: Sun Oct 11 14:50:09 2020 • BUILD SYSTEM: JelliaJamb