Scripted Field / Painless script fails upon slash for string match

Hi,

I am basically copy & pasting the first line of code under the section "Match a string and return that match" from this page: https://www.elastic.co/blog/using-painless-kibana-scripted-fields

def m = /^([0-9]+)\..*$/.matcher(doc['clientip.keyword'].value);


But I always get an error when the code reaches the slash in the script.
It also happens with other code samples from the page above, as soon as I reach a slash the script fails.

{
 "root_cause": [
  {
   "type": "script_exception",
   "reason": "compile error",
   "script_stack": [
    "def m = /^([0-9]+)\\..*$/.matcher( ...",
    "        ^---- HERE"
   ],
   "script": "def m = /^([0-9]+)\\..*$/.matcher(doc['clientip.keyword'].value);",
   "lang": "painless"
  },
  {


Any idea where I should look / what I should investigate to solve this?
Thanks in advance!

@codak7, if you look down further in the exception, do you see the following:

"reason": "Regexes are disabled. Set [script.painless.regex.enabled] to [true] in elasticsearch.yaml to allow them. Be careful though, regexes break out of Painless's protection against deep recursion and long loops."