You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: en/finding-sorting-and-cleaning-entries/search.md
+72-32Lines changed: 72 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,15 +13,6 @@ To make the cursor jump to the search field, you can:
13
13
14
14
To find the search history, you can right click in the search field. Only ten recent searches will be displayed in the sub-menu. You can find clear history button under your search history.
15
15
16
-
## Search settings
17
-
18
-
At the right of the search text field, 2 buttons allow for selecting some settings:
19
-
20
-
* Regular expressions
21
-
* Whether or not the search query uses [regular expressions](search.md#regular-expressions).
22
-
* Case sensitivity
23
-
* Whether or not the search query is case sensitive.
In a normal search, the program searches your library for all occurrences of the words in your search string, once you entered it. Only entries containing all words will be considered matches. To search for sequences of words, enclose the sequences in double-quotes. For instance, the query **progress "marine aquaculture"** will match entries containing both the word "progress" and the phrase "marine aquaculture".
@@ -30,25 +21,30 @@ All entries that do not match are hidden, leaving for display the matching entri
30
21
31
22
To stop displaying the search results, just clear the search field, press Esc or click on the "Clear" (`X`) button.
32
23
33
-
## Search using regular expressions <ahref="#regular-expressions"id="regular-expressions"></a>
24
+
## Search within specific fields
34
25
35
-
{% hint style="warning" %}
36
-
Make sure that the button "regular expressions" is activated
37
-
{% endhint %}
26
+
To search for entries whose author contains **miller**, enter: `author = miller`. The `=` sign is actually a shorthand for `contains`. Searching for an exact match is possible using `matches` or `==`.
38
27
39
-
### General syntax
28
+
If a field is not given, all fields are searched and one can mix the selection:
29
+
`video and year == 1932` will search for entries with any field containing `video` and the field `year` being exactly `1932`.
40
30
41
-
In order to only search for content within specific fields and/or to include logical operators in the search expression, a special syntax is available in which these can be specified. Both the field specification and the search term support [regular expressions](search.md#regular-expressions).
31
+
### Pseudo fields
42
32
43
-
#### Search within specific Fields
33
+
JabRef defines the following pseudo fields:
44
34
45
-
To search for entries whose author contains **miller**, enter: `author = miller`. The `=` sign is actually a shorthand for `contains`. Searching for an exact match is possible using `matches` or `==`.
|`anyfield` / `any`| Search in any field |`anyfield contains fruit`: search for entries having one of its fields containing the word **fruit**. This is identical to just writing `apple`. It may be more useful as `anyfield matches apple`, where one field must be exactly `apple` for a match. |
39
+
|`anykeyword`| Search among the keywords |`anykeyword matches apple`: search for entries which have the word **apple** among its keywords. However, as this also matches `pineapple`, it may be more useful in searches of the type `anykeyword matches apple`, which will not match `apples` or `pineapple`|
40
+
|`key`| Search for citation keys |`citationkey == miller2005`: search for an entry whose citation key is **miller2005**|
41
+
|`entrytype`| Search for entries of a certain type |`entrytype = thesis`: search entries whose type (as displayed in the `entrytype` column) contains the word **thesis** (which would be **phdthesis** and **mastersthesis**) |
46
42
47
-
####Search for terms containing spaces
43
+
## Search for terms containing spaces
48
44
49
-
If the search term contains spaces, enclose it in quotes. Do _not_ use spaces in the field specification! E.g to search for entries with the title "image processing", type: `title = "image processing"`
45
+
If the search term contains spaces, enclose it in quotes. Do _not_ use spaces in the field specification! E.g., to search for entries with the title "image processing", type: `title = "image processing"`
50
46
51
-
####Search using parentheses, `and`, `or` and `not`
47
+
## Search using parentheses, `and`, `or` and `not`
52
48
53
49
To search for entries with the title _or_ the keyword "image processing", type: `title|keywords = "image processing"`. To search for entries _without_ the title or the keyword "image processing", type: `title|keywords != "image processing"` It is also possible to chain search expressions. In general, you can use `and`, `or`, `not`, and parentheses as intuitively expected:
54
50
@@ -61,23 +57,67 @@ To search for entries with the title _or_ the keyword "image processing", type:
61
57
| (X) | X, as a capturing group |
62
58
| != | tests if the search term is _not_ contained in the field (equivalent to `not ... contains ...`) |
63
59
64
-
#### Regular Expression search and Field Types
60
+
##Search settings
65
61
66
-
The selection of field types to search (required, optional, all) is always overruled by the field specification in the search expression. If a field is not given, all fields are searched. For example, `video and year == 1932` will search for entries with any field containing `video` and the field `year` being exactly `1932`.
62
+
At the right of the search text field, two buttons allow for selecting some settings:
67
63
68
-
### Pseudo fields
64
+
* Regular expressions
65
+
* Whether the search query uses [regular expressions](search.md#regular-expressions).
66
+
* Case sensitivity
67
+
* Whether the search query is case-sensitive.
69
68
70
-
JabRef defines the following pseudo fields:
69
+
This applies to all "unfielded" search terms. Meaning: All search terms not specifying a field (e.g., `title`).
|`anyfield`| Search in any field |`anyfield contains fruit`: search for entries having one of its fields containing the word **fruit**. This is identical to just writing `apple`. It may be more useful as `anyfield matches apple`, where one field must be exactly `apple` for a match. |
76
-
|`anykeyword`| Search among the keywords |`anykeyword matches apple`: search for entries which have the word **apple** among its keywords. However, as this also matches `pineapple`, it may be more useful in searches of the type `anykeyword matches apple`, which will not match `apples` or `pineapple`|
77
-
|`key`| Search for citation keys |`citationkey == miller2005`: search for an entry whose citation key is **miller2005**|
78
-
|`entrytype`| Search for entries of a certain type |`entrytype = thesis`: search entries whose type (as displayed in the `entrytype` column) contains the word **thesis** (which would be **phdthesis** and **mastersthesis**) |
71
+
## Modifiers for fields
72
+
73
+
JabRef offers operators for the fielded search.
74
+
The general idea is to have `=` for contains search and `==` for exact matches.
75
+
Then, the `!` can be used to force case-sensitive matching (when used at the end) and as negation, when used in front.
76
+
Finally, the `~` sign is used to enable regular-expression-based search.
Remember, the regex option has no effect on "field = value" expressions.
96
+
To use regex with field names, the expression must have the form "field =~ value", which will apply the regular expression regardless of the ".*" regex option.
97
+
To put it another way, using `field = myterm` explicitly disables regex while `field =~ myterm` explicitly enables it, _on this term only without affecting the rest of the search._ Note that the "abc" case-sensitive option follows the same principle.
79
98
80
-
### Advanced use of regular expressions <ahref="#regular-expressions-advanced"id="regular-expressions-advanced"></a>
99
+
The idea makes sense, because it allows regex and non-regex terms to coexist in the same search.
100
+
101
+
However, in practice this is totally unintuitive and not worth the trade-off. My suggestion for the maintainers is to keep "field =~ value" explicit (always apply regex syntax for this term) and make "field = value" apply standard or regex syntax, depending on the regex button/checkmark. In other words, `=` and `=~` should be treated as equivalent when the regex option is enabled.
102
+
103
+
Personally, I keep regex enabled all the time, so adding escape characters as needed has become second nature.
104
+
105
+
This is how the search currently works in the development version.
106
+
107
+
| Terms | Regex | Term 1 | Term 2 |
108
+
|--------|--------|---------|---------|
109
+
|`title =~ pa*ediatric AND 1.0`| Off | Matches "paediatric", "pediatric" | Matches "1.0" |
110
+
|`title =~ pa*ediatric AND 1.0`| On |Matches "paediatric", "pediatric" | Matches "1.0", "1+0" "1/0", "1q0", ... |
111
+
|`title = pa*ediatric AND 1.0`| Off | No match. Regex is disabled | "1.0" |
112
+
|`title = pa*ediatric AND 1.0`| On | No match. Regex is disabled for this term |Matches "1.0", "1+0" "1/0", "1q0", ... |
113
+
114
+
## Search using regular expressions <ahref="#regular-expressions"id="regular-expressions"></a>
115
+
116
+
{% hint style="warning" %}
117
+
This has changed with JabRef v6
118
+
{% endhint %}
119
+
120
+
In order to only search for content within specific fields and/or to include logical operators in the search expression, a special syntax is available in which these can be specified. Both the field specification and the search term support [regular expressions](search.md#regular-expressions).
81
121
82
122
Regular expressions (RegEx for short) define a language for representing patterns matching text, for example when searching. There are different types of RegEx languages. JabRef uses regular expressions as defined in Java. For extensive advanced information about Java's RegEx patterns, please have a look at the [Java documentation](https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/regex/Pattern.html) and at the [Java tutorial](https://docs.oracle.com/javase/tutorial/essential/regex/).
0 commit comments