Device for regulating flow