Mastering Regex with Milyli’s Senior Customer Advocate, Cooper Legg
- Trent B.
- 6 days ago
- 3 min read
Learning regular expressions (regex) can be daunting, especially when you have a full-time job in eDiscovery.
Fortunately, Blackout users can ticket live-issues and book strategic calls with Cooper Legg, a Senior Customer Advocate at Milyli. He has years of experience solving tickets involving regex and their numerous applications for markup projects with Blackout.
Below, I talked with Cooper to document some regex writing insights we hope you find useful the next time you need to markup PII with Blackout. We've also included some practical documents and formulas you won't want to miss.
Trent: Milylians call you an expert because you manage our regex-related customer support tickets, but you also help our team understand it better. How did you become a “Regex Pro,” and what helped you pick it up as a skill?
Cooper: I started at Milyli in 2019 and to this day, I learn new things about regex quite often. It took about a year of reviewing requests regularly to build confidence. So, I mostly learned through practical experience helping customers and plenty of trial and error.
Trent: What do most reviewers find intimidating or difficult about using regex?
Cooper: Most reviewers I’ve worked with don’t use regex consistently. Writing formulas can be a little hard, but most people pick it up quickly and pretty well over time. It’s really that they forget when it’s useful.
Trent: Are there any particularly challenging formulas you can offer some tips on writing?
Cooper: Negative and positive variance for lookahead or lookbehind expressions can be extremely difficult – like those for redacting a first name, but only when the last name is found after it.
The regex structures aren’t hard to remember or write, but it can be hard to adjust for all the variations in PII-length that might be necessary.
Here are some useful examples Cooper shared to illustrate that complexity.
Example for Negative Lookahead: "Redact Tim not followed by Randall"
Tim (?!Randall)
Example for Positive Lookahead: "Redact Cooper only if followed by Cooper@milyli.com"
Cooper(?= Cooper@milyli.com)
Example for Negative Lookbehind: "Redact all emails besides those containing milyli.com"
\b[a-z0-9._%\+\-—|]+@[a-z0-9.\-—|]+\.[a-z|]{2,6}\b(?<!milyli.com)
Example of Positive lookbehind: "Only Emails preceded by From:."
(?<=From: )\b[a-z0-9._%\+\-—|]+@[a-z0-9.\-—|]+\.[a-z|]{2,6}\b
Trent: How do you QC your own work with regex?
Cooper: Regex101.com is my first stop for QCing actual regexes I've written. It won't work for every scenario but is reliable. It lets you quickly check if a regex is syntactically accurate. It also lets you perform live tests and isolate certain OCR issues.
Don't expect it to do everything!
I also recommend:
Keeping up the habit of checking "Os and 0s or L's and I's".
Remember as document sets scale in size, so will the variations of PII in them, so start broad and cull your rules later

I’m also available to jump on a call and give my “Regex 101” speech and jog the review team’s memories of best practices.
Trent: Anything you can share about what’s covered in that 101 chat?
Cooper: I can explain why a period isn’t a period!
And that's a great place to wrap for now. Thank you, Cooper!
Let us know if any of the information was useful or if there's more on this topic you'd like to see in future content. We're here to "Make It Like You Like It."
Milyli Time Machine: Bonus Content!
A while back, Cooper did an extended tutorial with Jeffrey Levinson, Milyli's Account Manager Lead, on writing effective RegExes. His recommendations still hold up, so be sure to check that out if you'd like to explore the subject further.
Comments