2023-11-10
In the past I have blogged about how I track and document the tax cases that I read. One of the components I document for each case is its citation.
I often make typos when inputting the citation. In order to catch my own errors, every time I document cases I have read, I run a Python script to confirm that all of the citations are valid. To do this, I use “regular expressions.”
Regular expressions (often referred to as “regex” or “regexp”) are a tool to find patterns in text. For example, the citation for a U.S. Supreme Court decision is represented by the following pattern:
1 to 3 digits followed by a space, followed by “U.S.”, followed by a space, followed by 1 to 3 digits, followed by a space, followed by an opening parenthesis, followed by 4 digits, and ending with a closing parenthesis
This pattern can be expressed in a regular expression as follows:
"\d+ U\.S\. \d+ (\d{4})"
Below is a table of regular expressions I use for citations to various courts. If anyone else uses regular expressions for tax-related items, I would love to hear about them.
Regular Expression for Citation | Applicable Court |
---|---|
\d+ U\.S\. \d+ \(\d{4}\) | Supreme Court |
\d+ F\.([23]d|4th) \d+ \(1st Cir\. \d{4}\) \d+ F\.([23]d|4th) \d+ \(2d Cir\. \d{4}\) \d+ F\.([23]d|4th) \d+ \(3d Cir\. \d{4}\) \d+ F\.([23]d|4th) \d+ \(4th Cir\. \d{4}\) \d+ F\.([23]d|4th) \d+ \(5th Cir\. \d{4}\) \d+ F\.([23]d|4th) \d+ \(6th Cir\. \d{4}\) \d+ F\.([23]d|4th) \d+ \(7th Cir\. \d{4}\) \d+ F\.([23]d|4th) \d+ \(8th Cir\. \d{4}\) \d+ F\.([23]d|4th) \d+ \(9th Cir\. \d{4}\) \d+ F\.([23]d|4th) \d+ \(10th Cir\. \d{4}\) \d+ F\.([23]d|4th) \d+ \(11th Cir\. \d{4}\) \d+ F\.([23]d|4th) \d+ \(D\.C\. Cir\. \d{4}\) |
Circuit Courts of Appeals (These could be reduced further, but I like to see them separated) |
\d+ F\.([23]d|4th) \d+ \(Fed\. Cir\. \d{4}\) |
Federal Circuit, started in 1982 |
\d+ F\.[23]d \d+ \(Ct\. Cl\. \d{4}\) | Court of Claims appellate division (pre-1983) |
\d+ Ct\. Cl\. \d+ \(\d{4}\) | Court of Claims trial division (pre-1983) |
\d+ Cl\. Ct\. \d+ | Claims Court 1983 to 1992 |
\d+ Fed\. Cl\. \d+ \(\d{4}\) | Court of Federal Claims (post-1992) |
\d+ F\. Supp\. \d[^d]\d* \d+ F\. Supp\. 2d \d+ \d+ F\. Supp\. 3d \d+ |
District Court |
\d+ BTA \d+ \(\d{4}\) | Board of Tax Appeals (until 1942) |
\d+ T\.C\. \d+ \(\d{4}\) | Tax Court |
\d+ T\.C\. No\. \d+ \(\d{4}\) | Tax Court (prior to being assigned a page number) |
T\.C\. Memo\.? \d{4}-\d+ | Tax Court Memorandum |
\d+ T\.C\.M\. \d+ | Tax Court Memorandum using CCH-style |
T\.C\. Summary Opinion \d{4}-\d+ | Tax Court Summary |
\d+ USTC | CCH-style for tax opinions not from the Tax Court |
\d+ AFTR \d[^d]\d* \d+ AFTR 2d \d+ |
RIA-style for tax opinions not from the Tax Court |