Search code examples
google-chromefirefoxclipboardimacros

Extraction - only numbers from address


The address of Japan is written in many sites as 〒000 - 0000. From this, I would like to extract only numbers using imacros. In other words, I want to remove and -. I want to copy the extracted data, save it on the clipboard and paste it in another place. Thank you.

(chrome 70.0.3538.102, Win10_x64)


Solution

  • Posting as a separate Solution, as the Input from the Extract is now "a bit" different and changes the Syntax in 'EVAL()' quite a bit, even if I tried to reuse a bit the same Syntax with the same Commands like in Answer_#1. (And that gives a 2nd Code Example...)

    SET !EXTRACT  "〒 000-0000"
    SET !VAR1 EVAL("var s='{{!EXTRACT}}'; var x,y,z; x=s.substr(2); y=x.split('-'); z=y[0]+y[1]; z;")
    SET !CLIPBOARD {{!VAR1}}
    PROMPT EXTRACT:<SP>_{{!EXTRACT}}_<BR>Numbers:<SP>_{{!VAR1}}_
    

    (Tested on iMacros for FF v8.8.2, Pale Moon v26.3.3 (=FF47), Win10_x64.)

    And again, there would be more than 10 different ways to implement the same Functionality to get the same Result...