The short answer is that you can't, as some of the strings could be infinite if you allow the *, + or repetitions which are open on the right eg. {4,}.
If you want to do it any way, then you have two strategies, both of which starts with parsing the regex, and building a state machine representing it.
Then you can either generate a random run through it of max length 'n'. This will give you a random string of at most length n. Or you can add an empty transition to all the states in your state machine to a terminal state, and simply do a random walk until you hit a terminal state. This will give you a completely random string, which the regex accepts, where the length has an arbitrary length, but longer strings are less probable. But please not that there is still an, albeit very very small, chance that this method will never end, as the string size grows, then the probability of outputting a new character falls, but just as the string length never hits infinite, neither does the probability of a new character hit zero.
That is almost exactly what the code posted in the comments by @neil-slater https://github.com/repeatedly/ruby-string-random
Edit
The OP asks if it is possible to generate a random string, which a given regular expression matches.
A regular expression is a string representation of a regular language. A finite automaton is a decider which encodes a given regular language, and can determine if a given string is part of that regular language. So basically the way regular expression matching works, is by compiling the regular expression to a finite automaton, and use that to see if it accepts the string. That's matching.
Now lets look at generation. You can use the same finite automaton to generate strings, however as a finite automata, as @sawa correctly pointed out, only works on finite strings, then you have to make sure that you only generate a finite string. One way of doing this is randomly deciding a maximum length, and then do a random walk of at most that length in the fintite automaton. One way of not doing this is the way both @sawa and I suggested of taking a transition with some probability, or simply stopping. As this potentially doesn't terminate, because the product of any non-zero probabilities, only approaches zero, but new reaches it.
rand(10).times.map { |a| 'a' }.join... 10 can be any number... :)