Who Posted December 30, 2007 Share Posted December 30, 2007 <UL class=vitals> <LI class=user-name><A title=Google href="http://google.com">Googl</A> </LI></UL></DIV> <DIV class=wrapper> <P class=comment><STRONG>Hello</STRONG><IMG src="http://www.google.com.vn/logos/holiday07_5.gif" border=0><BR>Hello</P> <P class=datestamp>Sun Dec 30</P>I'm new with regular expression and from this code, I have tried many times to get out these words : "Google", "http://google.com", "<STRONG>Hello</STRONG><IMG src="http://www.google.com.vn/logos/holiday07_5.gif" border=0><BR>Hello", "Sun Dec 30" but it seems that I don't any luck at all. Can anyone give me a working example please ? Thank you very much. Link to comment Share on other sites More sharing options...
martin Posted December 30, 2007 Share Posted December 30, 2007 <UL class=vitals> <LI class=user-name><A title=Google href="http://google.com">Googl</A> </LI></UL></DIV> <DIV class=wrapper> <P class=comment><STRONG>Hello</STRONG><IMG src="http://www.google.com.vn/logos/holiday07_5.gif" border=0><BR>Hello</P> <P class=datestamp>Sun Dec 30</P> I'm new with regular expression and from this code, I have tried many times to get out these words : "Google", "http://google.com", "<STRONG>Hello</STRONG><IMG src="http://www.google.com.vn/logos/holiday07_5.gif" border=0><BR>Hello", "Sun Dec 30" but it seems that I don't any luck at all. Can anyone give me a working example please ? Thank you very much. Do you want to just find if those strings occur, or just the positions of the strings or do you want to find all the occurances? What have you tried so far? Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Jex Posted December 30, 2007 Share Posted December 30, 2007 Try use _StringBetween ? My scripts : Immediate Window , My Web Browser , Travian , Text Effect , Characters & Words per minute or second , Image Editor (ImageMagick) , Matrix style background effect ( Screensaver ) , Mail Sender , Protectlinks decoder and Rapidshare links checker , Fonts Fetcher , Region determine , Compare pictures , Gradient color box , Mouse Coordinates, Colors, Pixel Search things , Encrypt/Decrypt and embeding file in jpeg thing , Hard disk space monitor , Reflex game , Multiplayer Tic Tac Toe , WLM ( MSN ) personal message changer Link to comment Share on other sites More sharing options...
Who Posted December 30, 2007 Author Share Posted December 30, 2007 (edited) $aArray0 = _StringBetween($chars1, '\href="', '">', -1, 1);Using SRE _ArrayDisplay($aArray2, 'StringRegExp Search') $aArray1 = _StringBetween($chars1, '\<P class=comment>', '\</P>', -1, 1);Using SRE _ArrayDisplay($aArray2, 'StringRegExp Search') $aArray2 = _StringBetween($chars1, '<P class=datestamp>', '\</P>', -1, 1);Using SRE _ArrayDisplay($aArray3, 'StringRegExp Search') $aArray3 = _StringBetween($chars1, '<LI class=user-name><A title=', 'href="', -1, 1);Using SRE _ArrayDisplay($aArray3, 'StringRegExp Search') I have tried this and I got the "Google", "http://google.com", "<STRONG>Hello</STRONG><IMG src="http://www.google.com.vn/logos/holiday07_5.gif" border=0><BR>Hello", "Sun Dec 30" but are there anyway for me to find all these occurances with StringRegEXP ? Can you help me please ? Edited December 30, 2007 by Who Link to comment Share on other sites More sharing options...
rasim Posted December 31, 2007 Share Posted December 31, 2007 (edited) <UL class=vitals> <LI class=user-name><A title=Google href="http://google.com">Googl…</A> </LI></UL></DIV> <DIV class=wrapper> <P class=comment><STRONG>Hello</STRONG><IMG src="http://www.google.com.vn/logos/holiday07_5.gif" border=0><BR>Hello</P> <P class=datestamp>Sun Dec 30</P> I'm new with regular expression and from this code, I have tried many times to get out these words : "Google", "http://google.com", "<STRONG>Hello</STRONG><IMG src="http://www.google.com.vn/logos/holiday07_5.gif" border=0><BR>Hello", "Sun Dec 30" but it seems that I don't any luck at all. Can anyone give me a working example please ? Thank you very much. This?: Dim $Txt = FileRead("c:\Test\test.txt") $str = StringRegExpReplace($Txt, '(?i)Google|http://google.com|<STRONG>Hello</STRONG><IMG src="http://www.google.com.vn/logos/holiday07_5.gif"|border=0><BR>Hello|Sun Dec 30', "") MsgBox(0, "", $str) FileClose($Txt) Edited December 31, 2007 by rasim Link to comment Share on other sites More sharing options...
Who Posted December 31, 2007 Author Share Posted December 31, 2007 <UL class=vitals> <LI class=user-name><A title= href="">Googl</A> </LI></UL></DIV> <DIV class=wrapper> <P class=comment> </P> <P class=datestamp></P> I have tried as you told and here is the output, but I'm going to get out the "Google", "http://google.com", "<STRONG>Hello</STRONG><IMG src="http://www.google.com.vn/logos/holiday07_5.gif" border=0><BR>Hello", "Sun Dec 30". Can you explain it for me please ? Link to comment Share on other sites More sharing options...
rasim Posted January 1, 2008 Share Posted January 1, 2008 WhoHello! Sorry, my knowing english is very bad. What you need: exclude said words or get only this words? Link to comment Share on other sites More sharing options...
Who Posted January 1, 2008 Author Share Posted January 1, 2008 I just want to get the words : "Google", "http://google.com", "<STRONG>Hello</STRONG><IMG src="http://www.google.com.vn/logos/holiday07_5.gif" border=0><BR>Hello", "Sun Dec 30" but I'm totally a newbie. Can you help me please ? Thank you very much. Link to comment Share on other sites More sharing options...
MrCreatoR Posted January 1, 2008 Share Posted January 1, 2008 I just want to get the wordsDo you want them into array? Check this: #include <Array.au3> ;Only for check the results $String = '<UL class=vitals>' & @CRLF & _ '<LI class=user-name><A title=Google href="http://google.com">Googl…</A> </LI></UL></DIV>' & @CRLF & _ '<DIV class=wrapper>' & @CRLF & _ '<P class=comment><STRONG>Hello</STRONG><IMG src="http://www.google.com.vn/logos/holiday07_5.gif" border=0><BR>Hello</P>' & _ @CRLF & '<P class=datestamp>Sun Dec 30</P>' $aRet = StringRegExp($String, '(?i)(?s)<A title=(.*).*href="(.*)".*P class=comment>(.*)</P>.*<P class=datestamp>(.*)</P>', 3) _ArrayDisplay($aRet) ;We got this returned: ;$aRet[0] = Google ;$aRet[1] = http://google.com ;$aRet[2] = <STRONG>Hello</STRONG><IMG src="http://www.google.com.vn/logos/holiday07_5.gif" border=0><BR>Hello ;$aRet[3] = Sun Dec 30 Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
Who Posted January 1, 2008 Author Share Posted January 1, 2008 Thank you very much but when I doubled the $String to : $String = '<UL class=vitals>' & @CRLF & _ '<LI class=user-name><A title=Google href="http://google.com">Googl</A> </LI></UL></DIV>' & @CRLF & _ '<DIV class=wrapper>' & @CRLF & _ '<P class=comment><STRONG>Hello</STRONG><IMG src="http://www.google.com.vn/logos/holiday07_5.gif" border=0><BR>Hello</P>' & _ @CRLF & '<P class=datestamp>Sun Dec 30</P><UL class=vitals>' & @CRLF & _ '<LI class=user-name><A title=Google href="http://google.com">Googl</A> </LI></UL></DIV>' & @CRLF & _ '<DIV class=wrapper>' & @CRLF & _ '<P class=comment><STRONG>Hello</STRONG><IMG src="http://www.google.com.vn/logos/holiday07_5.gif" border=0><BR>Hello</P>' & _ @CRLF & '<P class=datestamp>Sun Dec 30</P>' then the result is : [0]|Google href="http://google.com">Googl</A> </LI></UL></DIV> <DIV class=wrapper> <P class=comment><STRONG>Hello</STRONG><IMG src="http://www.google.com.vn/logos/holiday07_5.gif" border=0><BR>Hello</P> <P class=datestamp>Sun Dec 30</P><UL class=vitals> <LI class=user-name><A title=Google [1]|http://google.com [2]|<STRONG>Hello</STRONG><IMG src="http://www.google.com.vn/logos/holiday07_5.gif" border=0><BR>Hello [3]|Sun Dec 30 So what is wrong with this ? Can you tell me please ? Link to comment Share on other sites More sharing options...
MrCreatoR Posted January 1, 2008 Share Posted January 1, 2008 So what is wrong with this ?Well, this is different string, and need a little different pattern: StringRegExp($String, '(?i)(?s)<A title=(.*?) href="(.*?)">.*P class=comment>(.*?)</P>.*<P class=datestamp>(.*?)</P>', 3) Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
Who Posted January 1, 2008 Author Share Posted January 1, 2008 It works now, thank you very much for your help Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now