How do you match multiple lines with dot (DOTALL) in eclipse find regex

前端 未结 2 675
礼貌的吻别
礼貌的吻别 2021-01-19 08:32

I would like to convert this:

  def getEmployeeReminders(employeeId: Int, page: Option[Int], pageSize: Option[Int], js_callback: Option[String]) = Action {
          


        
2条回答
  •  日久生厌
    2021-01-19 09:01

    place the following at very beginning of the 'find' expression: (?s) also note, we use \R to insert a newline:

    Example:

    find:      (?s)= (Action[^}]*})
    replace:   = \R    Restrict(companyAdmin, new MyDeadboltHandler) {\R     \1}
    

    This takes something like this:

      def getEmployeeReminders(employeeId: Int, page: Option[Int], pageSize: Option[Int], js_callback: Option[String]) = Action {
          val reminders = Reminder.listForOne(employeeId, page, pageSize)
          getResponse(reminders, js_callback)
        }
    

    And replaces it with this:

      def getEmployeeReminders(employeeId: Int, page: Option[Int], pageSize: Option[Int], js_callback: Option[String]) =
        Restrict(companyAdmin, new MyDeadboltHandler) {
          Action {
            val reminders = Reminder.listForOne(employeeId, page, pageSize)
            getResponse(reminders, js_callback)
          }
        }
    

提交回复
热议问题