top of page

Excel Visual Basic Macro to Collect Legal Citations - Part 2


Here's a version of the code I posted last night which has been updated to include all of the same federal court citations, and New York State Court decisions as well.

Note how it has been modified so that a single search string can find volume and page numbers with 1 to 4 digits. [0-9]{1,4} collects any number with one to four digits.

Function findCites(sentance) Dim regEx As New VBScript_RegExp_55.RegExp Dim matches, s regEx.Pattern = "[0-9]{1,4} N\.Y\.S\.s?\d+(\w+)?( \([0-9]{1,6}\))?|[0-9]{1,4} N\.Y\.S\.2ds?\d+(\w+)?( \([0-9]{1,6}\))?|[0-9]{1,4} A\.D\.2ds?\d+(\w+)?( \([0-9]{1,6}\))?|[0-9]{1,4} N\.E\.s?\d+(\w+)?( \([0-9]{1,6}\))?|[0-9]{1,4} N\.E\.2ds?\d+(\w+)?( \([0-9]{1,6}\))?|[0-9]{1,4} N\.Y\.s?\d+(\w+)?( \([0-9]{1,6}\))?|[0-9]{1,4} N\.Y\.2ds?\d+(\w+)?( \([0-9]{1,6}\))?|[0-9]{1,4} B\.R\. s?\d+(\w+)?( \([0-9]{1,6}\))?|[0-9]{1,4} F\.R\.D\. s?\d+(\w+)?( \([0-9]{1,6}\))?|[0-9]{1,4} U\.S\. Dist\. LEXISs?\d+(\w+)?( \([0-9]{1,6}\))?|[0-9]{1,4} F\.2d\s?\d+(\w+)?( \([0-9]{4}\))?|[0-9]{1,4} F\.3d\s?\d+(\w+)?( \([0-9]{4}\))?|[0-9]{1,4} U\.S\.L\.W\.\s?\d+(\w+)?( \([0-9]{1,4}\))?|[0-9]{1,4} L\. Ed\. 2d\s?\d+(\w+)?( \([0-9]{4}\))?|[0-9]{1,4} S\. Ct\.\s?\d+(\w+)?( \([0-9]{4}\))?|[0-9]{1,4} U\.S\.\s?\d+(\w+)?( \([0-9]{1,4}\))?|[0-9]{1,2} U\.S\.C\. §\s?\d+(\w+)?( \([0-9]{1,4}\))?|[0-9]{1,4} F\. Supp\.\s?\d+(\w+)?( \([0-9]{1,4}\))|[0-9]{1,4} F\. Supp\. 2d\s?\d+(\w+)?( \([0-9]{1,4}\))?" regEx.IgnoreCase = True 'True to ignore case regEx.Global = True 'True matches all occurances, False matches the first occurance s = "" If regEx.Test(sentance) Then Set matches = regEx.Execute(sentance) For Each Match In matches s = s & "" s = s & "" & Match.Value & " " s = s & Chr(10) Next findCites = s Else findCites = "" End If End Function


Sean O'Shea has more than 20 years of experience in the litigation support field with major law firms in New York and San Francisco.   He is an ACEDS Certified eDiscovery Specialist and a Relativity Certified Administrator.

​

The views expressed in this blog are those of the owner and do not reflect the views or opinions of the owner’s employer.

​

If you have a question or comment about this blog, please make a submission using the form to the right. 

Your details were sent successfully!

© 2015 by Sean O'Shea . Proudly created with Wix.com

bottom of page