how to extract the certain word in id ?

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.

Moderators: Community Moderators, iMacros Moderators

Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.

how to extract the certain word in id ?

by a2515125 on Mon Oct 09, 2017 8:24 pm

imacro 8.9.7/windows10/FF50.1


hey,

I have trouble of extracting the certain word inside the id
I only can extract "rc.u_0_24" by my code but I want to extract "u_0_24" Only
how can I get rid of "rc." because they are packed as one....Orz

it is sad that we can not use * to replace variable inside" " in event mode


i think there are three ways to achieve it but dont know how to use regular expression correctly

1. extract u_0_24 from "rc.u_0_24"
2. replace "rc.u_0_24" as "rc\\.u_0_24"
3. clean "rc."

need a help at this part.....Orzzz


Code: Select all

SET !EXTRACT NULL
TAG POS=1 TYPE=DIV ATTR=CLASS:_1cx1<SP>_4qr4<SP>_4aay<SP>_4ab3<SP>_2qma EXTRACT=HTM

SET !VAR2 EVAL ("var s='{{!EXTRACT}}'; var z=s.split('\"'); z[11];")
'PROMPT {{!EXTRACT}}
PROMPT {{!VAR2}}



Image
Image
Last edited by a2515125 on Wed Oct 11, 2017 6:57 pm, edited 2 times in total.
a2515125
 
Posts: 84
Joined: Mon Dec 05, 2016 8:37 pm

Re: how to extract the certain word in id

by chivracq on Wed Oct 11, 2017 5:51 pm

a2515125 wrote:
Code: Select all
imacro 8.9.1/windows10/FF50.1


hey,

I have trouble of extracting the certain word inside the id
I only can extract "rc.u_0_24" by my code but I want to extract "u_0_24" Only
how can I get rid of "rc." because they are packed as one....Orz

it is sad that we can not use * to replace variable inside" " in event mode

i think there are three ways to achieve it but dont know how to use regular expression correctly

1. extract u_0_24 from "rc.u_0_24"
2. replace "rc.u_0_24" as "rc\\.u_0_24"
3. clean "rc."

need a help at this part.....Orzzz

imacro 8.9.1/windows10/FF50.1

Code: Select all
SET !EXTRACT NULL
TAG POS=1 TYPE=DIV ATTR=CLASS:_1cx1<SP>_4qr4<SP>_4aay<SP>_4ab3<SP>_2qma EXTRACT=HTM

SET !VAR2 EVAL ("var s='{{!EXTRACT}}'; var z=s.split('\"'); z[11];")
'PROMPT {{!EXTRACT}}
PROMPT {{!VAR2}}


Image
Image

Hum..., pretty sure FCI was not mentioned when I had checked the Thread after you had started it, it's always a bit "dangerous" to silently edit your Post later to add some missing Info, chances are I won't notice it, FCI is the first thing I check to decide if I read or not..., and you may post it a bit more "visible" at the complete beginning of your Post like I do in my Quote, rather than lost "somewhere" in the middle of your Post... (then I would already have replied 2 days earlier...)
But OK... hum, v8.9.1 is no Standard Version, you can better use v8.9.7 I would think..., which works on your FF50... and still until at least FF v55.0.3, which is the FCI I use myself...)

But, yep, to isolate your String, yep, 'split()' is the way, but you need a Double 'split()', for before and after your String, but that should be a 'piece of cake" if you understand a bit how 'split()' works, and I've already posted dozens of Examples on the Forum... :idea:
You can use more than 1 Char in the 'split()'... => Try using a longer String than only your '\"' on the Double Quote which forces you to keep the 12th Result for the 1st 'split()', stg that will be a bit more unique than only one single Double Quote... :idea:

Hum, and your Thread Title could use a "?", you are not sharing a 'HowTo'...! (One more Reason why I didn't reply then...) :roll:
Last edited by chivracq on Wed Oct 11, 2017 7:10 pm, edited 1 time in total.
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6490
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: how to extract the certain word in id ?

by a2515125 on Wed Oct 11, 2017 7:02 pm

thanks to mention that...
i will remember to put FCI at the very beginning of my post

yes I use imacros v8.9.7 and FF v50.1
the reason i use FF v 50.1 is beacause I need multifox v3.2.3 working as well
a2515125
 
Posts: 84
Joined: Mon Dec 05, 2016 8:37 pm

Re: how to extract the certain word in id ?

by chivracq on Wed Oct 11, 2017 7:31 pm

a2515125 wrote:thanks to mention that...
i will remember to put FCI at the very beginning of my post

yes I use imacros v8.9.7 and FF v50.1
the reason i use FF v 50.1 is beacause I need multifox v3.2.3 working as well

OK, "?" in the Thread Title, good...!

OK for your FCI, so you are on v8.9.7 and not v8.9.1, OK, that's more "Standard", afaik, there is no "Reason" to use v8.9.1...
(v8.8.2 + v8.8.7 + v8.9.7 + v9.0.3 are the 4 Versions that should be used, each with their own (Compatibility) "Reason"..)

And yep, nothing wrong with FF50, TechSupport now even recommends to use FF49 (together with v8.9.7), from some recent Thread in the 'News and Announcements' Sub-Forum because of FF56 breaking v9.0.3... I still haven't tried/tested if v8.9.7 still works on FF56, but if I can't get it to work (a bit properly like FF v55.0.3) and that I need to roll FF back, I will then probably go back to FF51 myself as some Command that I really use(d) ('FILTER') got broken from FF52 or FF53... :roll:

But OK, did you "progress" / find the Solution to isolate your String with a Double 'split()'...?
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6490
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: how to extract the certain word in id ?

by a2515125 on Thu Oct 12, 2017 2:05 am

NO :((

still struggling with regular expression.....
especially have no idea about double split...
a2515125
 
Posts: 84
Joined: Mon Dec 05, 2016 8:37 pm

Re: how to extract the certain word in id ?

by chivracq on Thu Oct 12, 2017 6:27 am

a2515125 wrote:NO :((

still struggling with regular expression.....
especially have no idea about double split...

Beh...!, the "Purpose" of the Double 'split()' is to avoid using 'REGEXP' which I find myself also very difficult to use while 'split()' is 10 times easier...

But I don't understand why you are struggling with what I call Double 'split()'... Your original Script already contains one (correct) 'split()' Statement... You simply need another one to cut your String on the other Side, that's all...!

And if you search the Forum a bit, check a few of my recent Posts, I think I probably use a Double 'split()' in 8 out of 10 (mini-)Scripts I write, you'll find oooooooodles of Examples...! :wink:
It's so easy that I don't want to write that Line for you, ah-ah...! :twisted:

This current Thread is actually very-very-very similar to some previous Thread of yours where you directly tried to use Double 'split()', then you already know what it is... (OK, even if I guess you finally went for some other Solution in that Thread provided by some other Advanced User who jumped into the Thread...) Which means as well, I've already used Double 'split()' for some previous-previous Thread(s) of yours...
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6490
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: how to extract the certain word in id ?

by chivracq on Mon Oct 16, 2017 8:37 am

And...?, any Progress in this one...?, as last Post is now already from 4 days ago...

Don't worry, if you are still stuck, I will give you the/a Solution, even if there is nothing very difficult in what you want to do, you should be able to find the Solution by yourself, as you keep needing the same Functionality/Technique in most of your (previous) Threads, you should have it "under control" by now, I would think... :o
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6490
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: how to extract the certain word in id ?

by a2515125 on Sat Nov 04, 2017 12:29 am

the answer is here finally...........thanks
------------------------------------------------------
sorry i am a not very working hard student last week. haha :idea:
I am surprised and impressed that you still follow up my question...thanks for that ^^

I was using the stupid way to try..............all its possibility
put all u_0_24/u_0_25/u_0_23/u_0_26 to try, it works most of time

but when I put some wait like couple of hours, it changes it patterns after every hours that beyond my guess such as u_2f_a/u_2f_x/u_*_*
that really pushes me to figure out the ultimate split method ......... :lol:


Code: Select all
SET !ERRORIGNORE YES
TAG POS=1 TYPE=DIV ATTR=CLASS:_4lmd<SP>_36bx<SP>_4-u2<SP>_4-u8 EXTRACT=HTM
SET !VAR1 EVAL ("var s='{{!EXTRACT}}'; var x,y,z; z=s.split('id=\"rc.');y= z[1].split('\" class=\"_4lmd');y[0];")
PROMPT {{!EXTRACT}}
PROMPT {{!VAR1}}
a2515125
 
Posts: 84
Joined: Mon Dec 05, 2016 8:37 pm

Re: how to extract the certain word in id ?

by chivracq on Sat Nov 04, 2017 10:49 am

a2515125 wrote:the answer is here finally...........thanks
------------------------------------------------------
sorry i am a not very working hard student last week. haha :idea:
I am surprised and impressed that you still follow up my question...thanks for that ^^

I was using the stupid way to try..............all its possibility
put all u_0_24/u_0_25/u_0_23/u_0_26 to try, it works most of time

but when I put some wait like couple of hours, it changes it patterns after every hours that beyond my guess such as u_2f_a/u_2f_x/u_*_*
that really pushes me to figure out the ultimate split method ......... :lol:

Code: Select all
SET !ERRORIGNORE YES
TAG POS=1 TYPE=DIV ATTR=CLASS:_4lmd<SP>_36bx<SP>_4-u2<SP>_4-u8 EXTRACT=HTM
SET !VAR1 EVAL ("var s='{{!EXTRACT}}'; var x,y,z; z=s.split('id=\"rc.');y= z[1].split('\" class=\"_4lmd');y[0];")
PROMPT {{!EXTRACT}}
PROMPT {{!VAR1}}

Ah...!, some Follow-up..., good...!

Yep, exactly what I meant, now you should have understood how the "Technique" works... The 2nd 'split()' could eventually be a bit simplified, to cut only on the 2nd Double Quote, without the whole 'class' part:
Code: Select all
SET !VAR1 EVAL("var s='{{!EXTRACT}}'; var x,y,z; x=s.split('id=\"rc.'); y= x[1].split('\"'); z=y[0]; z;")

But don't worry, your Solution is good enough... :D

Hum, be only a bit careful with the extra Space you've included directly after "EVAL", there is one Browser (I don't remember which one...) which doesn't accept that extra Space...
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6490
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)


Return to General Support & Discussions

Who is online

Users browsing this forum: Google [Bot] and 9 guests

-->