K-Young.
Read the wise advice above.
And also
always get hold of the Data Sheet for the regulator you wish to use.
There are zillions of different ones on the market.
Many look physically the same but their 'pinout' (i.e. what the little legs do) are often different.
May I just suggest the main parameters you should look at on the Data Sheet.
1. Obviously the Voltage Out.
And, if you use an adjustable type then check the equation to work out resistor values.
2. The Maximum Voltage INput.
Do not exceed it.
3. The voltage 'dropout'.
A regulator needs a bit of voltage 'headroom' to give you your 5V.
With a linear regulator like 7805 and many others, you need to supply it with a voltage that is higher than your desired output voltage.
How much higher? basically it will be Vout + Vdropout minimum.
Some regulators are called 'Low Dropout' or LDO. They don't need so much voltage headroom and are better with batteries (your batteries will last longer).
4. Quisecent Current.
i.e. basically, how much power the regulator uses to give you your desired voltage.
Can be important for battery powered devices.
The 'old faithfull' 7805 is a lovely, quaint, cheap, reliable regulator.
It is so old that archeaologists regularly find them in ancient rock strata.
It has a dropout voltage of 2V so you need to give it with >=7V to make it happy.
So, being powered by 4xAA wouldn't be good.
Anyway, have a look into the Data sheets.
For low power battery stuff look into LM2936 an LP2950 types.
But honestly, there are loads and if everyone posts their 'favourite' regulators it'll make you cross-eyed
We'll move onto power calcs if things get hot.