Issue: using Regular match in script


var text = ‘tt-text-tt’;
var key = /(?<=tt-).*(?=-tt)/g;
var output = text.match(key);

I can run it in any javascript enviorment but got failure warning with Drafts5.
Looking forward to your help.
Thx.

  • Remember to put your code in code blocks to stop the forum formatting it.
  • That code does not work in Scriptable either same error.
  • Pretty sure the JavaScript engine used on i*OS doesn’t support the assertions you are trying to use.

Thank you so much!
I am going to try other ways.

Non-capturing groups could accomplish what you need, something like:

(?:tt-)(.*)(?=-tt)

That’s what I did. Thank you very much! It works.