Perfect way to write a gsub for a regex match?

后端 未结 1 1755
南笙
南笙 2021-01-25 04:59

I am trying to write a gsub for a regex match, but I imagine there\'s a more perfect way to do this .

My equation :

ref.gsub(ref.match(/settings(.*)/)[1         


        
相关标签:
1条回答
  • Why not do the simplest possible thing that could work?

    ref.gsub(/(settings)(.*)/, '\1')
    
    0 讨论(0)
提交回复
热议问题