REGEXP, Can not compile regular expression

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Posts: 9245
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: REGEXP, Can not compile regular expression

Post by chivracq » Wed Dec 02, 2015 12:06 am

BlueOne wrote:To clarify the situation :D

I wanted to adapt this imacros (.iim) for javascript (.js):

Code: Select all

SEARCH SOURCE=REGEXP:"De ([0-9]{1} [0-9]{3} [0-9]{3} €)" IGNORE_CASE=YES EXTRACT=$1
I simply had to replace " of the REGEX by \"
So i finally succeed with this code:

Code: Select all

extract ="SEARCH SOURCE=REGEXP:\"De ([0-9]{1} [0-9]{3} [0-9]{3} €)\" IGNORE_CASE=YES EXTRACT=$1"+ "\n";
I use Imacros for Firefox 8.9.4 on Mac OS
Ah OK, thanks for the clarification indeed, so I was right with the _\"_, using Backslashes as well on MacOS, I didn't know for sure as I don't use .js Scripts and especially not on a Mac...!
BlueOne wrote:I am aware that this is not the most optimal thing to do ... :roll:
And thank you to share your experience with me.

Your second proposition works !!

Code: Select all

extract +="SET !VAR1 EVAL(\"var a=\\\"{{!EXTRACT}}\\\"; a.replace(\\\" \\\",\\\"\\\");\")"+ "\n";
Woaw...!, it works...!! I'm nearly more impressed than you, I guess, as I don't use this Construction/Syntax myself at all... 8)
Thanks for the Feedback...
- (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...
Post Reply