For the purpose of building an index I am searching for some words in a bunch of
latex files. This process is complicated by the fact that
latex has a discretionary hyphen command
\-, which indicates to
latex at which places it can break a word. I want to include it into my search, but so far I have not succeeded in doing so. For example I would need an expression that would match all of
or differently hyphenated instances of the same word.
I understand that to match the backslash beginning a latex command one has to type four backslashes, such as
$ grep \\\\mycommand *tex`.
vim I can search for such an expression via
/pā\(\\-\)*da\(\\-\)*pra\(\\-\)*cāra, so I thought in grep it would be something like
grep pā\(\\\\-\)\?da *tex (and so on, but already this one didn't match anything).