We obtain a new class of exact solutions for the Einstein-Maxwell system in static spherically symmetric charged star in (2+1)-dimensional gravity. In order to obtain the analytical solutions we treat the matter distribution anisotropic in nature admitting linear or nonlinear equation of state and the electric field intensity was specified. By choosing a suitable choice of mass function m(r), it is possible to integrate the system in closed form. All the solutions, which are obtained in both linear and nonlinear cases are regular at the center and are well behaved in the stellar interior. © 2015, Springer Science+Business Media Dordrecht.