Regex in java script does not match


i’m currently trying some java scripting in seatable. I’m having a table, where i import csv datasets from my banking app. I’d like to have some research possibility on rows, where i made an Amazon purchase. I noticed, that you can search for Amazon-Ids (like 345-1234567-1234567) in the amazon store.
I’d like to get the amazon order-id from a column and optionally generate a link, that i can easily click.

I wrote a java script script, that should do the lookup. I wanted to get the amazon order id with regex. But somehow the regex does not match. I tested it with two different regex-tester. Here is the script.

const amazonBaseUrl = "";
const subject = base.context.currentRow["Verwendungszweck"].toString();
  const amazonOrderId = subject.match("/\d{3}-\d{7}-\d{7}/");
  alert("I found the following order id: " + amazonOrderId);
  const url = amazonBaseUrl + amazonOrderId;
else {
  alert("Couldn't find an Amazon order id"); 

Any idea what could be wrong?

Right after this post i fiddled around a bit and found the solution. I had to double-escape the regex. So here is my fixed regex.

const regex = "\\d{3}-\\d{7}-\\d{7}";
1 Like

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