Skip to content

Make lookahead, lookbehind and/or conditional if else statements work for 'linked file regular expression search' and 'automatically set file links' (F7) #8152

@ThiloteE

Description

@ThiloteE

Relevant UI components:

image

Problem:

  • It is impossible to create proper search expressions that capture a fine grained date. Whenever [YEAR] is used, it leads to multiple attachments for linked entries that happened in the same year, regardless if the correct file was already linked via [DATE] prior to the [YEAR] search. See graphic:

image

Describe the solution you'd like

Solutions i am aware of:

  • Make field markers (such as [YEAR] or [DATE] work within the placeholder modifier :(x) for linked file regular expression search
    The following expression would be great to have, but is not possible currently:
    **/.*[auth.etal:regex("\\."," & "):regex("\\& etal","et al.")].*[Organization].*[DATE]:([YEAR][MONTH]:([YEAR]).*\\.[extension]
    (Translation: if and only if YYYY-MM-DD cannot be found, search for YYYY-MM. If and only if YYYY-MM cannot be found, search for YYYY.)
  • Add a more specific modifier or field marker that makes [DATE] work for YYYY or YYYY-MM. (Take into account that the entry in Jabref may consist of YYYY-MM or YYYY-MM-DD, whereas the file in folder may just be named YYYY or YYYY-MM. It still should work in these edge cases.
  • Allow a modifier to be marked as empty.
    If :(x) could be empty (and with that i mean literally no value as output), it would be possible to move on to the next search expression. I think this could create If, then statements (boolean expressions).
    Example: .*[DATE]:().*[YEAR].*\\-[MONTH]:().*[YEAR]
    Translation: If Date is empty, then search for YYYY-MM. If MM is empty, search for YYYY.

I don't know if all this or one one of these solutions are feasible within javaFX. I hope so.

Additional context

https://discourse.jabref.org/t/help-with-search-expression-for-automatically-set-file-links-f7-attach-files-to-entry/2991/3

JabRef 5.4--2021-10-15--93b8025
Windows 10 10.0 amd64
Java 16.0.2
JavaFX 17.0.0.1+1

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Low priority

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions