Query by regex not working in transaction

Let’s say I write an api that uses query-with-regex. I’m going to want to write an integration test for it. And because I’m keeping an eye on the future where I have many tests, I would want to make sure that the test data is fully isolated so tests start from a known clean position and can run in parallel. A way to do this, ideally, would be to run any test within a transaction and rollback without committing. No test would impact another test.

However, if I cannot query by regex within a transaction, using newly inserted but not committed test data, then I would need to commit the test data before issuing the query.

This means it would not be possible to run my tests in parallel because I would need to run them serially and wipe the test data in each test setup.