The TDCV2 data generator, an open-source tool for creating test datasets, has introduced a new RegExp-based generation feature. This functionality allows users to define the structure of data strings using regular expressions, which is useful for generating items like passport numbers, license plates, or SKU codes that follow strict formatting rules.
The tool supports standard regex syntax alongside custom extensions. Unlike traditional generators, TDCV2 requires explicit length constraints, such as {1,12} instead of the unbounded plus sign, to ensure the generator can calculate the total number of possible unique values. This design choice prevents ambiguity and allows for the enforcement of uniqueness constraints.
Advanced features include conditional logic within expressions, such as the ability to include or omit specific characters based on whether a previous group was matched. This allows for complex formatting, like phone numbers that switch between parentheses and hyphens, without duplicating logic or wasting randomness.
For scenarios requiring high data quality, the tool supports mixing rule-based generation with predefined lists. While simple rules can generate plausible-looking data like surnames, the author notes that lists are more efficient for large, specific datasets like regional codes or bank names. The system also includes a unique value mode that validates if the requested volume of data is mathematically possible before generation begins.





