2

How do you run this regex in Freemarker ? The \. makes the template to crash.

<#assign clean = raw?replace('resource.([^\.]+)', 'resource.$1', 'r')/>
Tk421
  • 6,196
  • 6
  • 38
  • 47

1 Answers1

2

Use r'resource.([^\.]+)' or 'resource.([^\\.]+)'. Otherwise the problem is that FTL strings also use \ as an escape character (Just like C, Java, etc.), and there's no \. escape.

ddekany
  • 29,656
  • 4
  • 57
  • 64