|
Post by MikiSoft on Sept 12, 2015 14:14:51 GMT
Basically, what you should know is how to extract strings from response headers and page which are involved in forming the next HTTP request. I do that on this way: First, I type string name and I open up String builder... and select Regex. The two fields will show below: So, if I want to extract this cookie from response headers: Set-Cookie: PHPSESSID=F45654FDGASDG5648G8976865G; I type in the first field this: PHPSESSID=(.*?); and press Insert, so I got this: And that's it. The second case is when I want to extract some part of the page, like this: <input type="hidden" id="auth" value="TWlraVNvZnQ="> I want to extract only value part, so I type this in the two fields for Regex: And when I insert it, I can test it before confirming: UPDATE: Someone asked me how to make a Regex command to extract this: <span>your points:</span> <p>70 GN</p> So for the new line we write \r\n (in some cases it's just \n), and also we must escape Regex special character / with \ before it, so all will look like this: >your points:<\/span>\r\n <p>(.*?)< And of course, since we want to extract only the dynamic value in (.*?), we make it like this: So when we insert it we can test it:
|
|
|
Post by MikiSoft on Oct 28, 2015 22:56:07 GMT
Here is one more complex example: Cash Balance</td> </tr> <tr class="white-box-reffral" align="center"> <td>$0.0020</td> So we need to extract $0.0020 dynamic value, but we need to prepare this part of the page source to be used in Regex. We won't go manually because there are many things to do here and we would eventually make some mistake, so we open up this page: textmechanic.com/Find-and-Replace-Text.htmlThe first step is to replace new line chars with \r\n, so we make it like this: The next thing is escaping special characters, so we go here: textmechanic.com/Escape-Literal-Characters.htmlAnd process it: We got \\r\\n and we don't want that, so we get back to correct it: The final thing is to replace \$0\.0020 with (.*?) and make Regex command from it, so at last we got this string: rg('[src]','Cash Balance<\/td>\r\n <\/tr>\r\n <tr class\="white-box-reffral" align\="center">\r\n <td>(.*?)<','$1') Note: If new line replacement ( \r\n) doesn't work, then select "Use regular expression" option and write just \n in both fields, so it will look like this:
|
|
|
Post by dwiedenau on Nov 6, 2015 8:36:10 GMT
What should i do if the PHPSESSID doesnt end with a ; it ends right after the id, how to get that?
|
|
|
Post by MikiSoft on Nov 6, 2015 14:54:50 GMT
In that case extract between PHPSESSID= and \s which will pull it all up to the first space or the end of a current line, so the command will be: rg('[src]','PHPSESSID=(.*?)\s')
|
|
Planck
Power Member
Posts: 26
Likes: 13
|
Post by Planck on Jan 22, 2016 9:47:46 GMT
RegExr is an online tool to learn, build, & test Regular Expressions (RegEx / RegExp). - Results update in real-time as you type.
- Roll over a match or expression for details.
- Save & share expressions with others.
- Explore the Library for help & examples.
- Undo & Redo with Ctrl-Z / Y.
|
|
argusx
New Member
Hello UniBotWorld!
Posts: 8
Likes: 3
|
Post by argusx on May 12, 2016 21:45:08 GMT
Note: Some expressions like lookahead and lookbehind won't work in classic Regex - but they would in .NET version (i.e. plugin).
|
|
gedabuz
New Member
Posts: 2
Likes: 0
|
Post by gedabuz on Jul 16, 2017 9:43:49 GMT
What if in case it is formatted like this
Cookie: CookieInfoScript=1; _ga=GA1.2.488119100.1498243524
|
|
|
Post by MikiSoft on Jul 16, 2017 21:46:20 GMT
What exactly are you trying to pull from there? The first cookie is static, the second is for Google Analytics which is irrelevant. You should look for cookies like PHPSESSID...
|
|
gedabuz
New Member
Posts: 2
Likes: 0
|
Post by gedabuz on Jul 17, 2017 14:21:21 GMT
I'm sorry I'm learning. I still do not understand what I should input. For websites that I just kerjan appear cookies like that. If I can ask how can I extract if the format is like this ? Captcha_token = $ ("input [name = 'captcha_token']") .val ()
|
|
|
Post by MikiSoft on Jul 18, 2017 1:57:07 GMT
That's not even a cookie, and I don't understand what are you exactly trying to point out there - no token is present there obviously, it's looks a line of some code for selecting specific element of the page. I think you misunderstood and mixed up something there entirely, since it seems illogical so far. By the way, if you want to post anything further please don't do it here but create a new thread in Help & support > Configurations section, and this time with concrete and concise question(s). Thanks.
|
|