Search with a hyphen

Trying to find my T-mobile item using the search box. The name field is “T-mobile account”, but searching on t-mobile returns every item with t-mobile, a hyphen, or a letter t in any field.
Using >name:t-mobile in the search box gets me all items with “t-mobile” in any field, not just name field. What am I doing wrong here?

Hey there, can you provide additional information, such as how many items you have with similar names, what kind of naming conventions you are following and what types of vault items you are looking for?

Are you performing vault maintenance or trying to autofill? If autofilling, you can also use the keyboard shortcut to quickly access anything with an associated URI

Ctrl/CMD + Shift + L Auto-fill, press again to cycle through matching logins

Would removing the hyphen and going with tmobile simplify the issue?

Try it like this and see if it works, @This_guy_again:

> name:t-mobile'

(Note: advanced search expressions like this do not work on mobile clients or the BW CLI.)

Not exactly, I get t-mobile as well as one with t-rex in the name. Something about that hyphen?

The hyphen character is tricky, because the Lunr search engine apparently ignores it. Although some special characters can be used with a backslash escape (e.g., \: to search for :), this approach does not work with hyphens. This behavior may be a bug.

The best you can do is one of the following expressions, which requires both t and mobile to be present:

>+t +mobile

or, to restrict the search to item names:

>+name:t +name:mobile

Vault maintenance. Autofill for the URI in firefox seems to work fine.

Now I want to know where I can sign up for this T-Rex website… :t_rex:

https://www.t-rex-racing.com/

They make motorcycle accessories.

Welp, sounds like I hit an edge case. Nothing life-threatening here, so I’ll just remember some of these tips in the future. Thanks.

Hey @This_guy_again - by chance are you using a Mac? There is an easy trick you can use to make this work, if so.

No, Win10, but thanks.

Well, it might still work, but I find this inconsistent on Windows keyboards, and you must have a keyboard with a numeric keypad for it to work.

In the name T-Mobile, replace the hyphen with a dash. Typically, the keyboard shortcut for a dash on Windows is CONTROL-MINUS (the minus key is on the number pad). It will turn T-Mobile into T–Mobile instead, which you can search with the expression:
> name:T–Mobile

For Mac users, the dash character is easily typed with the keyboard shortcut Alt-hyphen, in case anyone else is wondering.

1 Like

On a Mac, the Alt+hyphen shortcut creates an n-dash (–) , which can be reliably produced in Windows using Alt+0150 (I’ve found that Ctrl+minus is more commonly a shortcut for reducing zoom level). However, searching for an n-dash will not match a hyphen. Thus, the suggested approach will only work if one first replaces every hyphen in the vault with an n-dash.

1 Like

No, the idea is to make the name T-Mobile both searchable and unique. By replacing the hyphen with a dash and then searching the name with the dash, you achieve both. Does that make sense to you @grb? I am not sure I can articulate it any more clearly.

Yes, we’re saying the same thing.

My point is that @This_guy_again presumably wasn’t just seeking a solution for the specific vault entry for T-Mobile (in which case the “TMobile” workaround proposed by @dwbit would also work). For the n-dash workaround to serve as a general solution, one would have to comb through all vault items and replace every hyphen with an n-dash (e.g., “T–Rex”, etc.).

@This_guy_again - if you think replacing the hyphen with a dash might work for you, I recommend using it only on vault items where the item name contains just words that commonly appear in other item names. The remainder will be easily searchable, regardless of the hyphen (e.g., t-rex).

Also want to mentioned that if you do need to perform a quick batch operation, you can export the vault and condition the CSV file to search/replace if needed, just be sure to take care with downloading to a secure environment and removing afterwards.

…and taking care not to accidentally replace hyphens that appear inside URIs or inside passwords!

Also, anybody attempting this should be aware that by exporting and re-importing one’s vault, any file attachments, password histories, and revision date histories will be lost.

Furhtermore, I believe that an export/import via the .CSV format can only handle login items and secure note items, so any credit cards or identities would be lost.

Thanks for providing additional detail on that one @grb