Code validator before run cell in jupyter notebook/lab

Hi,
is there any way to implement a code validator that regex checks the code before executing cell?
i saw that somehow it can be done with ipython but are there ways to do it with other jupyter components?

Thanks