I read about one guy who did this by hooking the pedals to a hub motor as a generator, and then running the power to a second hub motor for drive. He reports that it "feels" like he's loosing almost 1/2 of his pedaling power. He does not provide loss calculations or too much science, simply reporting his experimental results.
It's kinda too bad about the various laws of thermodynamics. The most efficient use of pedal power is moving the bike through a chain, not charging a battery via a generator in order to extract energy later from the battery to a motor via a controller to run a bike - not that you could produce enough watt hours of energy in a short period of time to meaningfully charge your battery solely by pedalling. Too many frictional losses - like some kind of Rube Goldberg contraption. In general, regen as well is over-rated, maybe you get a max of 5% back by harnessing kinetic energy to use the hub motor "in reverse" (figuratively not literally) as a generator. I'd rather just release my stored potential energy from being on top of a hill as released kinetic energy when I freewheel down the hill. Regen prevents freewheeling and creates "cogging" - and is of course impossible in truly freewheeling geared motors, unless they are altered by fixing the clutch in the motor - whence cogging kicks in. I'm not sure where this idea of "pedalling to get electric energy to run the bike" comes from but it is a very widespread misconception - even #1 perhaps in the mental landscape of the novice ebiker. It just doesn't thermodynamically make sense - its like perpetual motion. It always seems to be the first question people ask about ebikes - modern batteries are so awesome that the whole idea makes little sense, and regen isn't worth the trouble as you could require two-way torque arms as well, as axle torque operates in opposite directions as power is applied or regenerated energy is extracted. You get more from pedalling by offsetting the amount of energy you take out of your battery as part of the shared contribution of you and your battery in moving you forward. Perhaps the main advantage of regen is you don't have to buy as many brake pads, as the regenerating motor will act as a brake. And your rim won't wear out as fast. Isn't it better to freewheel down a hill so you can glide faster up the other side of the hill, thus storing your kinetic energy at the bottom of the hill as a new supply of potential energy available later when you get to the top of the next hill? I just don't get regen at all really. Think of a hilltop as that point where you have successfully stored all that energy of pedalling, and it is just waiting to help you get home!