Question

I need to bookmark parts of a document from the name of paragraphs but the name of a paragraph is not always a valid name for a bookmark name. I have not found on Google or MSDN an exhaustive list of limitations for bookmark names.

What special characters are forbidden?

The only thing I found is that the length must not exceed 40 characters.

Was it helpful?

Solution

If you are familiar with regular expressions, I would say it is

^(?!\d)\w{1,40}$

Where \w refers to the range of Unicode word characters, which also contain the underscore and the digits from 0-9.

Expressed differently: The name must start with a word character (but not a digit), then any Unicode word character may follow up to an overall length of 40 characters. Word characters explicitly exclude white space and punctuation of any kind.

As divo states in the comments, bookmarks with names beginning with an underscore are treated as "hidden". It it is not possible to create bookmarks that begin with an underscore via the user interface, but you can do it through "Bookmarks.Add"

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top