0
Beantwoord

Encoding a colon in the URL for a filter parameter

Adam Rego Johnson 3 jaar geleden bijgewerkt door Christian Fritz 2 jaar geleden 3

Hello, I have keywords I am using to categorize my library (a bib file uploaded directly to BibBase), and I have created different URLs to filter the library by keyword for this purpose. Some of these keywords contain colons, i.e., "Data Sources: EIG Tax". The colon seems to be stopping me from doing this for these keywords, however, I can't figure out how to encode the colon into the filter URL parameter. I have tried various combinations of code, e.g., using %3A (https://bibbase.org/show?bib=https://bibbase.org/f/nKAPSyp34A9azBzJd/GCWealthProject.bib&sort=title&filter=keywords:Data%20Sources%3A%20EIG%20Tax), %58, or with "&nbsp" instead of "%20" using &#58, &#x0003A, and &colon. I expected %3A for the colon and %20 for the spaces to work, like it did for the keyword "Estate, Inheritance, and Gift Taxes" (though the comma actually gets converted to a semi-colon by the BibTeX export from Zotero using Better BibTeX, my code using %2C and %20 worked appropriately while using %44 or %2C with &nbsp did not (see https://bibbase.org/show?bib=https://bibbase.org/f/nKAPSyp34A9azBzJd/GCWealthProject.bib&sort=title&filter=keywords:Estate%2C%20Inheritance%2C%20and%20Gift%20Taxes#).

Given the disconnect between the two attempts at creating filtered links, I imagine the problem perhaps is that the colon is treated specially by BibBase given its other uses in the filter URL parameter? Do you have any idea how I can encode this colon properly into my URL parameter?

Thank you!

Adam

Under review

Hi Adam,

Yes you are correct. As described in https://bibbase.org/help#customizationoptions a second colon indicates the beginning of regular expression flags, e.g., to indicate case-insensitive matching (i). But since filters are regular expressions, you can still filter by keywords with colon simply by replacing the color by a dot ('.'), which indicates "any character" in regular expressions.

In your case, I don't see any publications with the "Data Sources: EIG Tax" keyword right now, so I cannot send you a sample link that shows it, but in theory it would be 

https://bibbase.org/show?bib=https://bibbase.org/f/nKAPSyp34A9azBzJd/GCWealthProject.bib&sort=title&filter=keywords:Data%20Sources.%20EIG%20Tax

Hi Christian,

Thank you so much, I'm still new to regex and didn't realize this was an option. Thank you so much! This works perfectly. I had actually just moved all the relevant references tagged with "Data Sources:" in their keywords to a separate library / BibBase page, should've realized, but using the period in a link for that BibBase page works great. Thank you!