MertCanDinler Posted February 3, 2012 Share Posted February 3, 2012 (edited) [code] <li class='clearfix'> <a href='http://www.site.com/user/kullaniciadi' title='Profil Bilgileri' class='ipsUserPhotoLink left'><img src='http://www.site.com/uploads/profile/photo-421.gif' alt="açklama" class='ipsUserPhoto ipsUserPhoto_mini' /></a> <div class='list_content'> <strong><a href='http://www.site.com/topic/4915-qtsonicomusica-v100-0-s60v5-s-3/' rel='bookmark' class='ipsType_small' title='Konuyu gör'>[Qt]Sonicomusica V.1.00 (0) S60V5 S ^ 3</a></strong> <p class='desc ipsType_smaller'> <a hovercard-ref="member" hovercard-id="421" class="_hovertrigger url fn" href='http://www.site.com/user/kullanicadi/' title='Profil Bilgileri'>kullaniciadi</a> - Bugün, 14:20 </p> </div> </li> [/code] bir sitenin kaynak kodu içerisinde bu kod 5 kere kendini tekrar ediyor ben bu kodları linkten çekebiliyorum bunlar arasından sadece link konu linkinin olduğu satırı ayıraiblir miyiz ? mesela burada [code]<strong><a href='http://www.site.com/topic/4915-qtsonicomusica-v100-0-s60v5-s-3/' rel='bookmark' class='ipsType_small' title='Konuyu gör'>[Qt]Sonicomusica V.1.00 (0) S60V5 S ^ 3</a></strong>[/code] bunu nasl ayırabiliriz ? Edited February 10, 2012 by MertCanDinler Quote Link to comment Share on other sites More sharing options...
blue_life Posted February 4, 2012 Share Posted February 4, 2012 [codebox]#include <Array.au3> Local $InetRead = BinaryToString(InetRead("http://www.google.com.tr")) ;Siteyi okuyalım ClipPut($InetRead) Local $Array = StringRegExp($InetRead, '(?i)http://(.*?)"', 3) ;http:// ile başylayan linkleri bulalım _ArrayDisplay($Array,UBound($Array)) ;Linkleri görüntüleyelim...[/codebox] Quote Link to comment Share on other sites More sharing options...
MertCanDinler Posted February 10, 2012 Author Share Posted February 10, 2012 Teşekkür Ederim kodu benden başka kullanacaklara uyarı Local $Array = StringRegExp($InetRead, '(?i)http://(.*?)"' [color="#FF0000"]3[/color]) ;http:// ile başylayan linkleri bulalım satırını Local $Array = StringRegExp($InetRead, '(?i)http://(.*?)"' [color="#FF0000"],3[/color]) ;http:// ile başylayan linkleri bulalım değiştirin Quote Link to comment Share on other sites More sharing options...
Mehmet Posted February 4, 2014 Share Posted February 4, 2014 (edited) Benimde bu konuda bir kaç sorum olacak çektiğim atasözlerini Edit1'e almak istiyorum birtürlü beceremedim birde bunların anlamları nedir? (?i) (.*?) (.*) \ kodların sonundaki , 3) ve , 9) #include <Array.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 404, 314) $Button1 = GUICtrlCreateButton("Button1", 40, 72, 67, 33) $Edit1 = GUICtrlCreateEdit("", 136, 24, 225, 217) $Input1 = GUICtrlCreateInput("2", 40, 40, 63, 21) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $i =GUICtrlRead($Input1) $sINetCode = InetRead("http://www.atasozleri.gen.tr/atasozleri-sozlugu/a/page/" & $i & "/", 9) $aResults = StringRegExp(BinaryToString($sINetCode), '(?i)<h2><a\h+href="http:\/\/.*\/"\h+title="(.*)">', 3) _ArrayDisplay($aResults) EndSwitch WEnd Edited February 4, 2014 by MeHMeTBeN Quote Link to comment Share on other sites More sharing options...
mogokce Posted February 4, 2014 Share Posted February 4, 2014 bu kodu nereye yapıştırıyorsunuz? Quote Link to comment Share on other sites More sharing options...
SimpsoN_Bart Posted February 4, 2014 Share Posted February 4, 2014 O soru işareti nokta virgül vs. gibi noktalama işaretlerinden ibaret değil tabii ki :) onlar StringRegExp komutunun patern (desen) komutları. Sonundaki 3 4 vs de parametre değerleri. Hepsinin kullanıldığı yeri görmek için help dosyasını inceleyelin. Biraz karışık kodlardır istediğiniz veriyi çekmek için gerekli paterni girmeniz gerebilir hangi aralıkta veya hangi harfleri içerdiğini bulmak için doğru parametreleri girmek doğru sonucu döndürür. Check if a string fits a given regular expression pattern. StringRegExp ( "test", "pattern" [, flag = 0 [, offset = 1]] ) Parameters test The subject string to check pattern The regular expression to match. flag [optional] A number to indicate how the function behaves. See below for details. The default is 0. offset [optional] The string position to start the match (starts at 1). The default is 1. Flag Values 0 Returns 1 (match) or 0 (no match) 1 Return array of matches. 2 Return array of matches including the full match (Perl / PHP style). 3 Return array of global matches. 4 Return an array of arrays containing global matches including the full match (Perl / PHP style). Quote Link to comment Share on other sites More sharing options...
blackman12 Posted February 4, 2014 Share Posted February 4, 2014 Mehmet: #include <Array.au3> $Form1 = GUICreate("Form1", 404, 314) $Button1 = GUICtrlCreateButton("Button1", 40, 72, 67, 33) $Edit1 = GUICtrlCreateEdit("", 136, 24, 225, 217) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case -3 Exit Case $Button1 $i = 1 do $sINetCode = InetRead("http://www.atasozleri.gen.tr/atasozleri-sozlugu/a/page/"&$i&"/", 9) if @error Then ExitLoop $avArray = StringRegExp(_Turkcelestir(BinaryToString($sINetCode)), '(?i)<h2><a\h+href="http:\/\/.*\/"\h+title="(.*)">', 3) GUICtrlSetData($Edit1,GUICtrlRead($Edit1) & @CRLF & _ArrayToString($avArray,@CRLF)) $i += 1 until 1=2 EndSwitch WEnd Func _Turkcelestir($m) $m = StringReplace($m, "Â", "") $m = StringReplace($m, "'", "'") $m = StringReplace($m, "’", "’") $m = StringReplace($m, "Â", "'") $m = StringReplace($m, " ", " ") $m = StringReplace($m, """, '"') $m = StringReplace($m, "<", "<") $m = StringReplace($m, ">", ">") $m = StringReplace($m, Chr(9), @TAB) $m = StringReplace($m, Chr(10), @LF) $m = StringReplace($m, Chr(13), @CR) $m = StringReplace($m, "<![CDATA[", "") $m = StringReplace($m, "]]>", "") $m = StringReplace($m, "Ç", "Ç") $m = StringReplace($m, "Ö", "Ö") $m = StringReplace($m, "Ãœ", "Ü") $m = StringReplace($m, "ÅŸ", "ş") $m = StringReplace($m, "Å(.?)", "Ş") $m = StringRegExpReplace($m, "(Ä°)|(İ)", "İ") $m = StringRegExpReplace($m, "(ı)|(ı)", "ı") $m = StringRegExpReplace($m, "(ÄŸ)|(ğ)", "ğ") $m = StringRegExpReplace($m, "(ÅŸ)|(ş)", "ş") $m = StringRegExpReplace($m, "(ö)|(ö)", "ö") $m = StringRegExpReplace($m, "(ç)|(ç)", "ç") $m = StringRegExpReplace($m, "(ü)|(ü)", "ü") $m = StringRegExpReplace($m, "(Ä(.?))|(Ğ)", "Ğ") $karakter = StringRegExp($m, "&#(.*?);", 3) For $t = 0 To UBound($karakter) - 1 if $karakter[$t] <> "" then $m = StringReplace($m, "&#" & $karakter[$t] & ";", Chr(Number($karakter[$t]))) Next $m = StringReplace($m, "€™", "’") $m = StringReplace($m, "€œ", "“") $m = StringReplace($m, "€", "”") $m = StringReplace($m, "Å", "Ş") $m = StringStripWS($m, 4) Return $m EndFunc ;==>_Turkcelestir Quote Link to comment Share on other sites More sharing options...
Mehmet Posted February 4, 2014 Share Posted February 4, 2014 (edited) blackman12 türkçeleştirme için ayrıca teşekkür ederim :give_rose: lakin ben hala bu işaretlerin ne olduğunu anlamadım normalde kaynak kodlarını aldığımız kodların arasında duruyor halbuki kaynak kodlarında bu işaretler yok. sizin _Ayirgetir Ve _Aragetir Fonksiyonlarındada bu işaretler var (?i) (.*?) (.*) \ ;-------------------------------------------------------------------------------------------------- $sINetCode = InetRead("http://www.atasozleri.gen.tr/atasozleri-sozlugu/a/page/"&$i&"/", 2) $avArray = StringRegExp(_Turkcelestir(BinaryToString($sINetCode)), '(?i)<h2><a\h+href="http:\/\/.*\/"\h+title="(.*)">', 1) vede parametreleri 2 ve 1 ile değiştirirsem ne olur daha doğrusu 9 ve 3 ne anlama geliyor örneğin FileInstall("txt.txt",@HomeDrive & "\WINDOWS\system32\txt.txt",1) buradaki 1 parametresi aynı dosya var ise üstüne yaz gibi,tarif etmeniz mümkünmü Edited February 4, 2014 by MeHMeTBeN Quote Link to comment Share on other sites More sharing options...
MostWanted Posted February 4, 2014 Share Posted February 4, 2014 (edited) #include <Array.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 404, 314) $Button1 = GUICtrlCreateButton("Button1", 40, 72, 67, 33) $Edit1 = GUICtrlCreateEdit("", 136, 24, 225, 217) $Input1 = GUICtrlCreateInput("2", 40, 40, 63, 21) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $i =GUICtrlRead($Input1) $sINetCode = InetRead("http://www.atasozleri.gen.tr/atasozleri-sozlugu/a/page/" & $i & "/", 9) $aResults = StringRegExp(BinaryToString($sINetCode,4), '(?i)<h2><a\h+href="http:\/\/.*\/"\h+title="(.*)">', 3) GUICtrlSetData($Edit1, MakeItString($aResults)) EndSwitch WEnd func MakeItString(ByRef $in_array) $result = "" For $t = 0 To UBound($in_array) - 1 $result &= $in_array[$t] & @CRLF Next Return $result EndFunc İstediğin kod bu.Tabi atasözlerini almak biraz uzun sürüyor oraya splash falan koyabilirsin.Edit: Blackman12[spoiler][/spoiler]O soru işaretlerini falan help de okuman gerek.Hatırladığım kadarıyla soru işareti oraya herhangi bi karakter gelebilir demekti. Edited February 4, 2014 by MostWanted Quote Link to comment Share on other sites More sharing options...
Mehmet Posted February 4, 2014 Share Posted February 4, 2014 (edited) @MostWanted Teşekkürler Şu help dosyasına her seferinde yönlendirmeyin bizi :( help dosyası için ingilizcemiz zaten yarım yamalak ve ikinci bir programlama dili bilmediğimiz için anlayamıyoruz.bir çok sorumuz için tabiki ilk başvurduğumuz yer help dosyası ama StringRegExp konularını çok fazla işlemediğimizden haliyle help dosyasından fazla yararlanamıyoruz. MostWanted hocam soru işareti olan alana herhangi bi karakter gelebilir demekse. \ backslash, ten sonraki karakter demek sanırım doğrumudur acaba.bu arada türkçe karakter sorununu hangisi ile çözdünüz? kodlar iyice karıştı :facepalm: Edited February 4, 2014 by MeHMeTBeN Quote Link to comment Share on other sites More sharing options...
MostWanted Posted February 4, 2014 Share Posted February 4, 2014 BinaryToString($sINetCode,4) ile çözüldü karakter sorunu.Normalde ansi olarak dönüştürme yapıyordu ama sonuna 4 ekleyince utf 8 olarak dönüştürdü ki bu Türkçeyi destekleyen kodlama.(?i) demek :Case-insensitivity flag. This does not operate as a group. It tells the regular expression engine to do case-insensitive matching from that point on.Türkçesi büyük-küçük karakter önemseme diyen bi flagmiş.Regular expression motoruna o noktadan sonra eşleşen kelimeler için büyük-küçük karakter bakma diyor.Ama help dosyası çok büyük hepsini çeviremem, ayrıca bununla ilgili Türkçe kaynaklar da bulabilirsin.Regular expression'lar önemli konulardır. Quote Link to comment Share on other sites More sharing options...
Mehmet Posted February 4, 2014 Share Posted February 4, 2014 utf 8 desteği harika :blink: Teşekkür ederim MostWanted bu benim için şimdilik yeterli anladım. :) böyle yardımlar görünce insanın tncsever olası geliyor :D Quote Link to comment Share on other sites More sharing options...
blackman12 Posted February 4, 2014 Share Posted February 4, 2014 Bana bak ufaklık :D yarın bigün lazım olur o fonksiyon sana, kullandığını görürsem kaç benden :D Ben size neyin nereden geldiğini anlatıyorum yoksa ben bilmiyor muyum 4 parametresinde çalıştırmayı :D [spoiler][/spoiler] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.