User Input + Ruby + Regex?

后端 未结 1 1906
情歌与酒
情歌与酒 2021-01-05 10:38

I want to give users a text area where they can enter text. Later I will match that input against a different input and extract it if matched.

Flow:

  • Us
1条回答
  •  执笔经年
    2021-01-05 11:05

    You need to escape the input: http://www.ruby-doc.org/core/classes/Regexp.html

    See the method escape.

     Regexp.escape(your_input)
    

    0 讨论(0)
提交回复
热议问题