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


Contact Me With Your Litigation Support Questions:

seankevinoshea@hotmail.com

  • Twitter Long Shadow

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