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 ofpdapracrapda\-pracrap\-da\-pra\-c\-raor 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`.In vim I can search for such an expression via /p\(\\-\)*da\(\\-\)*pra\(\\-\)*cra, 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).
How to grep for a word taking into account hyphenation?
grep;latex