How to strip text out of the results of an OCRExtract process with ExecuteScript_Sandbox

Hi everyone,

I can’t quite figure this out. I’m trying to extract a page width and page height to two invidual variables that I can use later in my macro.

I’ve created an OCRExtract step which extracts the page size written like:

egs.
210 x 297mm
4102 x 1243mm

Read Page Size

But I would like to extract that text into:
210
297

I’ve been searching post and the web and I understand that I need to use a Javascript running within an ExecuteScript_Sandbox to do it.

But I just can’t decipher how to write the javascript from the posts I did find. I’d love to be self sufficient on how to write these javascripts to strip out and parse the text in my macros. It would be very liberating!

Can anyone explain how I would do this with this example above?

Many thanks everyone!

For example… I found this post but couldn’t for the life of me figure out how to adapt this to my macro. I’m not a programmer. I tend to fumble around until I figure something out. But this is truly beyond me.