A more specific method is the Karl Fischer titration. This relies on the reaction of water with sulfur dioxide and iodine in the presence of base. It is a well known, well understood reaction. It is easily automated, with many automatic titrators available. However, it is not without potential problems.
Many samples are hygroscopic, absorbing atmospheric moisture during handling.
Also, the sample must be dissolved in a suitable solvent prior to titration, but the solvent itself must be as anhydrous as possible. Methanol or pyridine are frequently used. Finally, some compound types, especially aldehydes and ketones, will interfere with the Karl Fischer titration, necessitating the use of different reagents. Since pharmaceutical sample sizes are frequently quite limited, all of these problems must be anticipated and overcome before the project is begun. WCAS has analyzed countless different sample types using these methods.