The issue you often run into trying to use a flashlight that was not designed for use on a rifle is some type of failure with the LED emitter/driver assembly due to shock from the recoil. hmm...I will apologize in advance just in case this gets a little technical and/or flashlight geeky.
If you need what is likely the toughest light on the market, look at Elzetta weapon lights. They don't run off of AA or AAA, however, if it is a weapon light there will likely be quite a bit of on-off use and two CR123a batteries will last quite a while. Also, the CR123A batteries have quite a few advantages over standard AA or AAA. For example, you can buy a 12 pack of CR123A for around $15-$20 on Amazon and put them on the shelf for quite a while. If you don't need them for seven or so years, they will still work (rated shelf life is 10 years, self-discharge rate <1% per year max).
The Elzetta ZFL-M60-SS2A with standard bezel, standard lens, 2-cell body and remote tape switch with 5" cable for $214 is an outstanding light for a rifle. http://www.elzetta.com/Webpages/Build%20Your%20Light/build_your_light.htm
^you can even select the angle to where it is better for longer range or more of an even flood for closer distances depending on your intended use.
If you want something that is a little less expensive, not quite as bright but still very reliable:http://www.ondutygear.com/control/product/~product_id=STL-TACTICALSTRION?gclid=COry6MTW_bQCFQioPAodTCkADg
^note: that one is rechargeable.
^If you have never heard of Malkoff Devices, they make very high quality flashlights and drop-in light modules. In fact, the Elzetta flashlights mentioned above use Malkoff Devices drop-ins.
On the other hand, if you do not plan to beat nails into a 2x4 with your tactical light and you do not plan to have it on the weapon every time you go to the range, then you could possibly get by with something considerably less expensive. However, you are running a slight risk that it might fail when you really need it (bad juju if this is a firearm intended for self-defense). With that disclaimer, if I had a limited budget for a weapon light...
I'd buy this flashlight body:http://www.lighthound.com/Solar-Force-L2P-Flashlight-Host-for-18650--L2P-Host-HA-III-Black-Finish_p_3473.html
Drop this module into the front of it:http://www.lighthound.com/Solar-Force-XM-L-U2-Drop-In-3-Mode-27--9-Volts_p_4110.html
and attach it to a rail with this mount:http://www.lighthound.com/Solar-Force-M-001-Gun-Mount-for-L2-Flashlight_p_3979.html
~$50 for all three parts and it will run off of two CR123A batteries or a single 18650 rechargeable battery.
If you want to make it rechargeable:
two of these:http://www.lighthound.com/Solar-Force-Li-Ion-Lithium-Ion-18650P-Rechargeable-Battery--Protected_p_2576.html
and a 18650 battery charger:http://www.lighthound.com/XTAR-WXTAR-WP2II-Charger--2-Bay-Charger-for-14650-17670-18650-etc_p_3975.html
That would give you one battery to keep in the light and one spare -- grand total: ~$80.
The nice part about that last option would be the run-times with the 18650 battery. As it is a three mode light, you can get some really extended run-time if you need it. A single 18650 battery would give you:
High setting: 500 lumens for 2 hours
Medium setting: 225 lumens for 4 hours
Low setting: 30 lumens for 35 hours