Answers.Body: <p>You might try using the existing <em>Path</em> column, which can be parsed for files already added to the Calibre library, as well as new additions.</p>
  <p><a href="https://i.sstatic.net/L0tA6.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/L0tA6.png" alt="Calibre Path" /></a></p>
  <p>Define a <a href="https://manual.calibre-ebook.com/template_lang.html" rel="nofollow noreferrer">Custom Column</a>, and create a <em>Template</em> parsing the <em>Path</em> and <em>Title</em> as you wish.</p>
  <p><a href="https://i.sstatic.net/AjI5d.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/AjI5d.png" alt="Edit Custom Column" /></a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-01-21T21:48:35.723Z
Answers.LastActivityDate: 2024-01-21T21:48:35.723Z
Answers.UserDisplayName: DrMoishe Pippik
Body: <p>I need some help with regex, or maybe templates if regex isn't the best way. I know nothing about Python and am just getting into Regex because of Calibre.</p>
  <p>Trying to add some metadata to columns during import.</p>
  <p>I have a magazine collection with 2 levels of folders, 1 root level and 1 sub level folder with all the magazines from that year. The top level is the magazine name such as &quot;Make&quot;, then underneath the year folder(s) with the issues inside for each year. Each issue is named with the month and year, such as: December 2018.pdf</p>
  <p>What I have done is just pulled out all the magazine files and placed them flat in another folder.
  I am looking to Parse the filename for the month and year and place that data into .</p>
  <p>Tried A lot of regex things and have got as far as matching some data with various regex experiments. Everything just goes into the Title field on the regex test page. How come something like this doesn't populate  with the year ?</p>
  <p>(?P[^_0-9-]+)</p>
  <p>I understand as far as parsing the filename to find a match. I am at a loss as to the high level next steps as well.</p>
  <ol>
  <li><p>Assuming I have found a matching filename, do I need to &quot;capture&quot; the data, or is it captured when parsed ?</p>
  </li>
  <li><p>I am thinking of doing a column with just the year, and trying the month Year and using series to sort each mag chronologically.</p>
  </li>
  <li><p>maybe just putting each item into it's own column.</p>
  </li>
  </ol>
  <p>Any help would be appreciated.</p>
  
Tags: <calibre>
Title: Calibre: Can't get regex to populate columns with meta data by lookup name on Import
UserDisplayName: Thomas
ThreadText: # Calibre: Can't get regex to populate columns with meta data by lookup name on Import
  
  (Asked by: username_0 on 2024-01-13)
  
  I need some help with regex, or maybe templates if regex isn't the best way. I know nothing about Python and am just getting into Regex because of Calibre.
  
  Trying to add some metadata to columns during import.
  
  I have a magazine collection with 2 levels of folders, 1 root level and 1 sub level folder with all the magazines from that year. The top level is the magazine name such as "Make", then underneath the year folder(s) with the issues inside for each year. Each issue is named with the month and year, such as: December 2018.pdf
  
  What I have done is just pulled out all the magazine files and placed them flat in another folder.
  I am looking to Parse the filename for the month and year and place that data into .
  
  Tried A lot of regex things and have got as far as matching some data with various regex experiments. Everything just goes into the Title field on the regex test page. How come something like this doesn't populate with the year ?
  
  (?P[^\_0-9-]+)
  
  I understand as far as parsing the filename to find a match. I am at a loss as to the high level next steps as well.
  
  1. Assuming I have found a matching filename, do I need to "capture" the data, or is it captured when parsed ?
  2. I am thinking of doing a column with just the year, and trying the month Year and using series to sort each mag chronologically.
  3. maybe just putting each item into it's own column.
  
  Any help would be appreciated.
  
  **Tags:** calibre
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-01-21. Score: 0
  
  You might try using the existing *Path* column, which can be parsed for files already added to the Calibre library, as well as new additions.
  
  [![Calibre Path](https://i.sstatic.net/L0tA6.png)](https://i.sstatic.net/L0tA6.png)
  
  Define a [Custom Column](https://manual.calibre-ebook.com/template_lang.html), and create a *Template* parsing the *Path* and *Title* as you wish.
  
  [![Edit Custom Column](https://i.sstatic.net/AjI5d.png)](https://i.sstatic.net/AjI5d.png)
  
  
  ---
  
  