rigsel wrote:Hi guys,
How can I do a Regex replace, so a text replacement using Regular Expression?
I guess I need to use EVAL and javascript REPLACE but it only works with normal text, not with regex.
Here's my test code to remove the "22":
Code: Select all
SET !VAR1 Regex-22-Replace
PROMPT {{!VAR1}}
SET !VAR2 EVAL("var str=\"{{!VAR1}}\"; var x=str.replace(\"\\d+\", \"\"); x;")
PROMPT {{!VAR2}}
While the non-regex replace works fine:
Code: Select all
SET !VAR2 EVAL("var str=\"{{!VAR1}}\"; var x=str.replace(\"22\", \"\"); x;")
rigsel wrote:Anyone?
I'm using iMacros for Chrome, version 8.4.4

Aaaahhh...!, that's already "better", iMacros Version finally mentioned..., but CR Version and OS are still missing for me to have a look...
=> FCIM...!

(Read my Sig...)
=> Applies to your
"other" Thread as well where I already asked you, and which is still waiting for some Follow-up from your Side, oops...!
Sorry, but you should make some little "Effort" to start using the Forum "a bit correctly" if you want me to help you, that would "speed up the Process" if you are really looking for a Solution...
And selecting the correct Sub-Forum each time you open a Thread belongs as well to "using the Forum a bit correctly", the 'iMacros for CR' Sub-Forum is meant for Threads specific to iMacros for CR only and Scripts that work in other Browsers but fail in CR... (Correct Sub-Forum would have been the 'General' one..., but no need to duplicate now...)
Even if hum..., you had searched the Forum for your other Thread and managed to find a similar/related Thread, that was a "very correct Use of the Forum", ah-ah...!

- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...