Albert
Albert

Reputation: 15

iMacros: Extract numbers from a string

If i have the following string.

dhs4dtgsf678ds6fsgfd

How can i use iMacros to extract all the numbers from this string?

I have found many tutorials for extracting text and images but can't find a single one that describes about numbers extraction.

Upvotes: 1

Views: 3956

Answers (1)

Poker Joker
Poker Joker

Reputation: 382

Use EVAL, for example:

    SET !EXTRACT dhs4dtgsf678ds6fsgfd
    SET !VAR1 EVAL("var x=\"{{!EXTRACT}}\"; x=x.replace(/\\D/g,\"\");")
    PROMPT {{!VAR1}}

The result will be 46786

Upvotes: 1

Related Questions