• Resolved ivgg

    (@ivgg)


    Hi!

    Is it possible to use regular expressions by uploading a media in the bulk edit to set metadata of it (e.g. title)?

    I want upload some PDF files with filenames like jegyzokonyv-201606131600-14_2016.pdf or jegyzokonyv-201809101600-HAR_185_22_2018-20_2018.pdf and set the titles of it based on the filenames to Jegyz?k?nyv 2016.06.13. 16:00, 14/2016 or Jegyz?k?nyv 2018.09.10. 16:00, HAR/185/22/2018, 20/2018.

    I have created the following content template for the title field, but when I upload the media the title will be set to the name of the PDF file, also e.g. for jegyzokonyv-201809101600-HAR_185_22_2018-20_2018.pdf to jegyzokonyv-201809101600-HAR_185_22_2018-20_2018.

    template:[+name_only,extract( '/jegyzokonyv-(?<year>\\d{4})(?<month>\\d{2})(?<day>\\d{2})(?<hour>\\d{2})(?<minute>\\d{2})(?:-HAR_(?<number11>\\d{3})_(?<number12>[0-9A-Z]{2})_(?<number13>\\d{4}))?-(?<number21>\\d{2})_(?<number22>\\d{4})/' )+](Jegyz?k?nyv [+matches:year+].[+matches:month+].[+matches:day+]. [+matches:hour+]:[+matches:minute+](, HAR/[+matches:number11+]/[+matches:number12+]/[+matches:number13+]), [+matches:number21+]/[+matches:number22+])

    I’m doing something wrong or can I don’t use regular expressions in this case?

    Thank you!

    • This topic was modified 4 years, 6 months ago by ivgg.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author David Lingren

    (@dglingren)

    Thanks for your question and for the details of your template and file names; very helpful.

    As an experiment, I created a couple of PDF documents using your file names and uploaded them to my test system. Next, I created an IPTC/EXIF mapping rule using your template. When I ran the mapping rule on my test files, the template was applied and the item Titles were updated to the values you want.

    I then entered your template in the Bulk Edit Area on the Media/Add New (Upload New Media) screen and uploaded the documents again. Your template did not work, although a simple template (“template:[+name_only+]”) did work.

    I have reproduced your problem, which I believe is an MLA defect. I will investigate further and see if I can correct the problem. I will post an update here when I have progress to report.

    Plugin Author David Lingren

    (@dglingren)

    I have uploaded a new MLA Development Version dated 20200517 that corrects the handling of templates containing backslashes in the Bulk Edit Area of the Upload New Media screen. You can find step-by-step instructions for using the Development Version in this earlier topic:

    PHP Warning on media upload with Polylang

    It would be great if you could install the Development Version, rerun your uploads and let me know if you find any problems. Thanks for alerting me to this MLA defect, and for your interest in the plugin.

    Thread Starter ivgg

    (@ivgg)

    Thank you! Your fix worked in my case.

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your update with the good news confirming the fix.

    I am marking this topic resolved, but please update it if you have any remaining problems or questions. Thanks again for helping me find and fix this MLA defect.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Possible to use regular expressions by upload in bulk edit?’ is closed to new replies.