Illegal cosmetics containing hazardous substances such as mercury, hydroquinone, and Rhodamine B remain widely circulated in Indonesia, while ordinary consumers struggle to recognize these substances because they are listed on packaging using unfamiliar Latin chemical names. This study aims to address that problem by developing SafeBeauty, a client-side web application that treats cosmetic-ingredient screening as a regular-language recognition problem solved with Deterministic Finite Automata (DFA). For each hazardous substance drawn from a database of more than 60 entries compiled from BPOM RI (Indonesian Food and Drug Authority) regulations, a dedicated per-pattern DFA M = (Q, Σ, δ, q0, F) is constructed and executed against normalized label text from multiple substring starting positions, so a hazardous name embedded inside a longer compound name can still be recognized. The application also integrates Tesseract.js Optical Character Recognition (OCR) for photo-based scanning and renders an interactive state-diagram visualization of each DFA trace. Black-box testing across ten functional scenarios produced a 100% pass rate, with hazardous substances consistently accepted and safe substances consistently rejected without any false positive. These results indicate that a transparent, per-pattern DFA is an effective and auditable model for hazardous-ingredient screening in cosmetics.
Copyrights © 2026