Misc. Resources

Specified Mini-Lesson

MIDAS#5 Redact credit card numbers with REGEX (Midas Rich Text LSX)

This demo shows how to use the REGEX (regular expression) search & replace functionality in the Midas Rich Text LSX to find and redact credit card numbers in Notes rich text.

If you would like to try out this sample and you do not currently have a Midas license, request an evaluation license, and one will be mailed to you. Download the Credit Card Redaction with REGEX sample db, or take a look at our many other sample databases at the Midas LSX Samples page.

This samples requires Midas 4.x or higher.

' Connect to item and define chunk as everything
Call rtitem.ConnectBackend(doc.Handle, "Body", True)
Set rtchunk = rtitem.DefineChunk("Everything")

' Call RegexReplace method to redact Visa and MC card numbers
' To only find numbers with whitespace before and/or after, use
' \s instead of \D at the beginning and/or end of the first expression
Call rtchunk.RegexReplace("(^|[\D*])(4\d|5[1‒5]{1})\d{2}[ \\-]?\d{4}[ \\-]?\d{4}[ \\-]?(\d{4})([\D*]|$)", "$1xxxx-xxxx-xxxx-$3$4")

' Change the subject just to show it has been altered
' You would not usually do this in a mail database, of course
doc.Subject = doc.Subject(0)+" - redacted"

Copyright © 2014 Genii Software Ltd. All Rights Reserved.