In 5G networks with SDN architecture, the traffic explosion and the rising of diverse service requirements lead to many challenges for 5G core networks on flexibility and scalability. In order to achieve high-speed forwarding of traffic and diversified transmission requirements in the 5G era, combined with SDN and Segment Routing, we propose a scalable flow forwarding scheme called Segment Routing based on Path Aggregation and Rule sharing (PARS-SR) to solve SDN switch flow table resource shortage problem. Traditional OpenFlow-based or MPLS-based flow forwarding scheme may lead to performance degradation due to flow-table overflowed or heavy MPLS label load incurred. PARS-SR exploits SDN, Segment Routing and intelligent path encoding algorithm to achieve a trade-off between flow table resource and MPLS label load. The proposed PARS-SR can learn the flow path information online to implement path aggregation and rule sharing by aggregating a large number of flows into a small number of flow entries based on the coincidence degree of the flow path. To find the optimal flow path aggregation scheme, we present an intelligent encoding algorithm to maximize the overall cost saving. The simulation results show that PARS-SR can effectively reduce both the number of flow entries and the MPLS label load of the packet.