We have prepared nanoporous polymers from columnar hexagonal hydrogen-bonded complexes, whose order is fixed by coumarin photoinduced [2 + 2] cycloaddition (photodimerization). Two different hydrogen-bonded complexes were used and consisted of a melamine (M) or tris(triazolyl)triazine (T) derivative acting as central templates and three peripheral carboxylic acids containing coumarin units. These coumarin units were employed for the cross-linking process by photodimerization in order to fix the LC arrangement. Template removal leads to the formation of self-standing nanoporous polymers keeping the columnar hexagonal order. Two nanoporous polymers with different pore diameters were obtained depending on size of the utilized template. These polymers with carboxylic acids at the pore surface demonstrate the ability to selectively adsorb certain molecules depending on their size. Moreover, after base treatment of the nanoporous polymers, they are able to adsorb cationic dyes over anionic and larger cations, demonstrating size- and charge-selective adsorption.