.drone.star: "found unknown escape character" with backslash x 1 or 2

I found an issue with .drone.star and regular expression or specific characters in command line in .drone.star.
Let me explain it using this repository to report the issue.

In the repository, .drone.yml is my goal. That is to remove ::1 … line in /etc/hosts by a regular expression. It works like this.

Following is the line in .drone.yml, and the key is “\s”.

  - name: test
    image: ruby:2.5-stretch
      - ruby -e "hosts = File.read('/etc/hosts').sub(/^::1\s*localhost.*$/, ''); File.write('/etc/hosts', hosts)"

It finally worked when replacing “\s” with “\\s” (backslash x 4) in .drone.star.
But when it is “\s” in .drone.star, it has an error “found unknown escape character”.


Is it expected behavior?
Thank you.