Escaping a forward slash / in a regex match


This should be rather simple but I'm definitely overthinking this. I've tried escaping a forward slash in a regex match for a painless script in an ingest pipeline and it fails every combination I try. I have the following ingest pipeline script. Original without any attempts at escapes:

 if (ctx.position ==~ /.*yiut/houst.*/) {
    ctx.location = "Yiut - Houston";
  } else {
  if (ctx.position ==~ /.*yiut/atl.*/) {
    ctx.location = "Yiut - Atlanta";
  else {
    ctx.location = "Unknown Location";

How would I properly escape the forward slash in this regex match? Its getting a little frustrating painless can be anything but.


This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.