In situ crystal structure transformation is an important method for the emergence of new structures. Currently, there are very limited reports on crystal structure transformation in hydrogen-bonded organic frameworks (HOFs), and such transformation only occurs in response to external stimulation. Herein, we report a rare solvent-etching-induced in situ crystal structure transformation in UPC-HOF-12 and UPC-HOF-13 (UPC-HOF = China University of Petroleum-hydrogen-bonded organic framework). Remarkably, molecule recognition is observed in the crystal structure transformation, i.e., only N,N′-dimethylformamide (DMF) as the etching agent can cause the in situ crystal structure transformation, as evidenced by the consecutive changes in crystal morphology and time-dependent powder X-ray diffraction patterns. Simultaneous cleavage and regeneration of the flexible and fragile hydrogen bonds are observed with the determination of the single crystal structures. This rare example of solvent-etching-induced in situ crystal structure transformation with maintained crystallinity after crystal fragmentation can provide a new perspective for elucidating the crystal growth process in HOFs.