regexextractimacrosletter

iMacros - How to Extract the first 100 Characters from a `TAG CONTENT`?


I am using this code in iMacros to extract only the first 100 characters from TAG CONTENT and it's working in 80% of the cases, but sometimes iMacros displays an error message:

"TypeError: Cannot read properties of null (reading 'join'), line: 27"
(Line 27 in iMacros Code is where the code is executed.)

=> My question:
Is there another way to do this, another Regex code, or did I do something wrong with the script below?

TAG POS=1 TYPE=DIV ATTR=ID:title EXTRACT=TXT
SET titlu100 EVAL("var x=\"{{!EXTRACT}}\"; x=x.match(/^.{100}/).join(''); x;")

I am using (FCI):
iMacros for CR v10.1.1 'PE', CR v105.0.5195.102 (_x64), Win10_x64.
('CR' = 'Chrome' / 'PE' = 'Personal Edition')


Solution

  • Meanwhile I found another way to extract first 100 characters

    SET titlu100 EVAL("\"{{!EXTRACT}}\".substr(0,100);")