The samples are illustrations of particular APIs, not apps ready for use. "The application displays a dialog box in which the user can select a PDF file and input a word (in Roman characters only) to find."
A property of getPageNthWord is that it returns exactly one word. Words are separated by punctuation. Almost every way of writing a date is going to include punctuation, so it's going to be more than one word. Multi-word searches (without punctuation) are entirely possible, but the logic is much more complex.