How to generate random strings from regx?

Hi, Guz!
I'm working on a scripts compiler which needs a function to generate random strings. I think REGX may be a good solution to restrict the string format. Before DIYing I'd like asking for any existing libs or codes.
Any help will be appreciated!

What's the language and OS ?
For instance, perl has handy examples in just a few lines.

The compiler is written in C++ under both Linux(GCC) and Win32(VC2008).

A program taking REGEX as arguments and generating random strings as result is also fine.
Thx for response!

You can use the rand function available in cstdlib (stdlib.h)

Reference: rand - C++ Reference

I need a rand function generating strings.

Google "generate random strings"

I googled "random string" and "regx", and found String::Random - Perl module to generate random strings based on a pattern - search.cpan.org to be the most satisfied. But i don't know Perl at all, and i think it isn't completely regex supported.