Rest of the letters are more important. LM7805 or L7805 are not full part numbers.
LM- and L- are just from different manufacturers. They have tiny differences which might matter in some really specific design but usually not. If it matters, usually designer makes a clear note about it ("careful: no substitutions; National Semi's part used because of parameter XYZ...")
Rest of the letters denote stuff like current capability, IC package (size, shape and pinout) which are hugely important; or temperature ranges, accuracy etc. which usually are important, too.
Most importantly though, make sure you are not getting counterfeits. Ebay is nearly guaranteed failure, local stores are iffy but if this is all you have, go for it and hope for the best. 78xx series are one of the most counterfeit ICs because the IC is quite simple. Counterfeits sometimes work seemingly fine but may have lower current capability, or lack some protection features.