Since the format of the email address is consistent it was easy to pull out the section I was interested in. Well, it was easy until it broke when the email was sent in from a specific email client. Turns out this client set the value of the email address to something different:
After getting over my frustration at this email client I looked at what the regular expression matched:
Well that was no good. Instead of just matching the XXXXXX it was slurping up other portions of the email address as well. Enter the greed factor of Perl Compatible Regular Expressions (PCRE). If you aren’t familiar with greedy regular expressions it simply means that they try to match as much as the can. Fortunately there is a way to turn off the greediness using the U pattern modifier. By adding a U to the end of the regular expression things got much better:
Now even the odd ball email address was extracting just the XXXXXX in the regular expression.
Using the U at the end turns off greediness for the entire regular expression. You can turn off the greediness of a single quantifier (the * in this case) by following it with a ?. Using that technique the regular expression is anamehere\+(.*?)@.*$ which works as well.
If you find that your regular expressions are matching more that you want remember that they are greedy by default.
I love the ability where I can plan, prioritise, design, develop and deliver blended learning solutions for a variety of markets. I love to consult and advise about the best use of digital learning and improve design standards in line with evolving ways of working. I also enjoy to keep up to date with, understand and regularly recommend emerging technologies and practice to improve individuals, teams and organisational capabilities.
With over 12 years digital learning experience and demonstrated experience in both instructional design and eLearning development, I have also a lot of experience conducting training needs analysis including how to leverage principles such as design thinking and root cause analysis to understand and address performance gaps. I also have led many facilitation workshops and even presented at iDesignX and Game Developers Conferences both here in Australia, Wales and in the United States.
With strong multimedia, training and programming backgrounds, I understand modern learner behaviour including micro and social learning, I am very familiar with most LMSes and app-based (XCode and Android Studio), adult learning models and e-solutions.
I also possess the ability to manage multiple projects simultaneously, whilst being pro-active in delivering work independently with minimal supervision, but enjoy working in teams.
I've been told I am a resilient, relationship focused guy which can manage and navigate conflicting views and stakeholders/subject matter experts.
View more posts