Skip to main content
Inspiring
May 25, 2013
Question

Get the searching result of a RegEx search

  • May 25, 2013
  • 1 reply
  • 551 views

Hi, I have a RegEx search which does something like this:

var k = new RegExp('myRegExpression');

if(myText.match(k)){

     do something..

}

How can I get the searching result of my RegExp via scripting?

From within Indesign, I think this value is returned by the expression "$0"

Thanks in advance

This topic has been closed for replies.

1 reply

Inspiring
May 25, 2013

Hi,

var myRes = '123123'.match(/1/g) //->['1','1'] == array

What ever you wanna do on that Result ...

Inspiring
May 25, 2013

Thanks, very helpful