faustf

StringRegExp ( is my hell ) take some link

18 posts in this topic

hi guy 

i  have  a page html in  a part of  page  i have   this  code 

value="Chiudi" abp="2591" type="button"> </div>
</div>
</div>
</div>
</div>
<div class="pagination pagination-centered" abp="2592">
<ul abp="2593">
  <li class="disabled" abp="2594"><a href="#"
 abp="2595">Prima</a></li>
  <li class="disabled" abp="2596"><a href="#"
 abp="2597">Precedente</a></li>
  <li class="disabled" abp="2598"><a href="#"
 abp="2599">1</a></li>
  <li abp="2600"><a
 href="/b2b/Ricerche?r=14.-9223372036831454874&amp;modo=0&amp;page=1"
 abp="2601">2</a></li>
  <li abp="2602"><a
 href="/b2b/Ricerche?r=14.-9223372036831454874&amp;modo=0&amp;page=2"
 abp="2603">3</a></li>
  <li abp="2604"><a
 href="/b2b/Ricerche?r=14.-9223372036831454874&amp;modo=0&amp;page=1"
 abp="2605">Successiva</a></li>
  <li abp="2606"><a
 href="/b2b/Ricerche?r=14.-9223372036831454874&amp;modo=0&amp;page=2"
 abp="2607">Ultima</a></li>
</ul>
</div>
<div class="row-fluid" abp="2608">
<div class="span3" abp="2609"></div>
<div class="span9" abp="2610">
<div class="toolBar gradient clearfix" id="toolbar2"

i want  take  a this links 

"/b2b/Ricerche?r=14.-9223372036831454874&amp;modo=0&amp;page=1

all link after  href

how  is possible do this ?

Share this post


Link to post
Share on other sites



Have you tried anything?


Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites

You should take some time to learn regex if you have to use them so much  :)

$str = FileRead("1.html")
$res = StringRegExp($str, 'href="(/b2b[^"]+)', 3)

Share this post


Link to post
Share on other sites

yea mikell  but  you should  give me  some  tutorial-link ??? 

Share this post


Link to post
Share on other sites

maybe use google?


Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites

johnone  ,  sorry for my  english i use a google translate  ,  you should  explain , a  sense  of  this   "How about a link to where you help one single person however small, in the 4 years you have been here." i dont  understund  

laments the fact that in four years have not helped anyone ? or i not  understind  good? ? ?

sorry 

Share this post


Link to post
Share on other sites

what is your native language?

JohnOne is saying. Why help you? When you help no one for 4 years.

If you can spell regex you can search google for it.


Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

i would say your hell is assuming you need regex for simple splitting

#include <Array.au3>

$aFile = filereadtoarray("test.txt")

For $i = ubound($aFile) - 1 to 0 step -1
    If Stringleft(stringstripWS($aFile[$i] , 1) , 4) = "href" Then
        $aFile[$i] = stringtrimleft(stringstripWS($aFile[$i] , 1) , 5)
    Else
        _ArrayDelete($aFile , $i)
    EndIf
Next

_ArrayDisplay($aFile)
Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

faustf,

To learn about Regexes I always recommend this site. :)

But I completely agree with boththose - as I was told by GEOSoft when I started learning about them, a good part of understanding Regexes is to know when not to use them. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

not for do a countroversy or  do a flame  

but  sorry  how  can  help  someone  if  i am not a  good  programmer ?, (and  speak  no so good in english )

immagine:  i try  to help  when  finsh understund  a  questions  ,  other people  (much better and  intelligent of me )  had  just  answer ,  what  i must  tell??  

Share this post


Link to post
Share on other sites

for melba  ,  but regexep  is  the  same  for  all type  of  progam-language??  or   autoit  have  syntax  and  java  have  another  syntax ? 

Share this post


Link to post
Share on other sites

faustf,

Please ignore the comment from JohnOne - he speaks for himself alone. ;)

Regexes are similar in most languages, so the basic principles are applicable regardless of the one you use. There are however some differences so you need to take care, but the PCRE (Perl Compatible Regular Expressions) engine used by AutoIt is pretty standard and widely used. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Same site I used to learn linked above.  I learned some but far from mastery.

I think what "got me" is it seems a lot of what is standard regex is stated different in autoit and I was not sure how to "translate it" to the proper format.

Share this post


Link to post
Share on other sites

ViciousXUSMC,

 

it seems a lot of what is standard regex is stated different in autoit

Not so in my experience - everything I learnt from that site was directly applicable in AutoIt. Although I freely admit that I am far from a guru and stick generally to fairly simple regexes. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

thanks so much at  all 

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

not for do a countroversy or  do a flame  

but  sorry  how  can  help  someone  if  i am not a  good  programmer ?, (and  speak  no so good in english )

immagine:  i try  to help  when  finsh understund  a  questions  ,  other people  (much better and  intelligent of me )  had  just  answer ,  what  i must  tell??  

Never meant to get your back up, just a response to your demand for a tutorial link.

I get a sick feeling in my stomach every time I'm looking at something where I know RegExp will be great, then I jump through hoops to work around it.

Anyway, I'm going to definitely try to learn it henceforth if you care to join me.

I'll start a thread sometime soon, begging people who understand it to help put things into baby word, spoon fed context.

Keep your eye out for it, I'll probably get blown out :)

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now