Extract email address from text with Regular Expression in AutoHotkey

Extract email addressA white stress ball with the green AutoHotkey logo being held in a hand, with a laptop keyboard blurred in the backgroundRegular Expressions are incredibly helpful for day-to-day tasks!  In this short video I demonstrate how easy it is to use a Regular Expression (RegEx) in AutoHotkey to extract email addresses from text.  The first half of the video shows how I use it to parse the haystack listed in the script.  The second half of the video I make a minor tweak and adapt it to work with any program that you can copy text to the clipboard.

Below is the code to extract emails with a Regular Expression that I demonstrate in the video

Extract email addresses via Regular Expression in AutoHotkey

A black AutoHotkey branded water bottle on a desk beside a laptop, with a person reading a newspaper in the background

RegEx 111) How to Ignore Whitespace in AutoHotkey Regular Expression

Ignore Whitespace in AutoHotkey Regular ExpressionAutoHotkey Merchandise-White Stress ballLong Regular Expressions can be very difficult to read and revise when you come back to it later.  Using the X) option allows you to Ignore Whitespace in AutoHotkey Regular Expression and insert comments as well as spread out your RegEx over multiple lines.

Below is the example code I use to ignore the whitespace in AutoHotkey RegEx which is demonstrated in the video below.  It is a great way to make your code easier to read & maintain.  It may take a few months until you revisit your RegEx but, when you do, you’ll thank me for it!

Ignore Whitespace in AutoHotkey Regular Expression

Two women smiling and looking at a computer screen together in a bright office, one pointing at the monitor.

RegEx 110- Example using AutoHotkey Regular Expression on naming convention

AutoHotkey Regular Expression on naming conventionAutoHotkey Merchandise-White Stress ballI’ve found the best way to learn RegEx is to actually play with it.  For that reason I’m making a few videos that will demonstrate actual use-cases.  In this example I demonstrate applying an AutoHotkey Regular Expression on naming convention.  As I show in this video, there are a ton of different ways you can write a Regular Expression that will capture what you need.  There isn’t a “right” & “wrong” way, just make sure what you use is reliable and makes sense to you.

Video demonstrating AutoHotkey Regular Expression on naming convention

Four colleagues seated at a meeting table, with a green AutoHotkey water bottle in the center