mrgrosser Posted August 11, 2011 Share Posted August 11, 2011 (edited) I really am new to this. I've searched the forums and google for this answer and I can't seem to find anything that fits. Thankfully in the past when using AutoIT I have always been able to pirate someones code and make it work for what I've been doing. So what it boils down to is this, I'm pulling an RSS feed to a txt file using _INetGetSource, that comes down no problem. What I am then trying to do is search that file, feed.txt for 12 characters. These characters are random, contain letters and numbers, but are always contained between /> and <br. I've been looking at StringRegExp and StringInStr and even with the examples it is a little over my head. And then from there I'm trying to take its finding and put them into a text file. If someone could point me in the right direction that would be awesome. If I am asking to much and need to keep searching, I understand. Thanks Edited August 11, 2011 by mrgrosser Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 11, 2011 Moderators Share Posted August 11, 2011 mrgrosser,Welcome to the AutoIt forum. This works for me: $sString = "blah blah blah />123456789012<br blah blah blah" $sText = StringRegExpReplace($sString, ".*>(.*)<.*", "$1") ConsoleWrite($sText & @CRLFIf you want to learn about SREs, I recommend this website. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
mrgrosser Posted August 11, 2011 Author Share Posted August 11, 2011 Thank you very much this is getting me going. Since I have no idea what ConsoleWrite does now I am on to writing $sText to a file. I appreciate the help and pointing me in the right direction! Link to comment Share on other sites More sharing options...
mrgrosser Posted August 11, 2011 Author Share Posted August 11, 2011 Ok, maybe I'm not understanding this properly, but I've been reading through your recommended website on SRE's... and now I'm not understanding even more. the line of $sString = "blah blah blah />123456789012<br blah blah blah" would denote that is what I'm looking for when in reality it is a set of 12 random letters and numbers wrapped in /> and <br. So wouldn't the string be more like $sString = "blah blah blah />[A-Z0-9]{12}<br blah blah blah" or am I reading this completely wrong. Or is it in the StringRegExpReplace that I need to put that [A-Z0-9]{12} expression?Thanks Link to comment Share on other sites More sharing options...
GEOSoft Posted August 11, 2011 Share Posted August 11, 2011 (edited) If it only occurs once on the page then a StringRegExpReplace() should do it otherwise you will want a StringRegExp() with the flag probably set to 3.This should be a decent expression but without seeing the actual page there is no sure way of knowing.$s_String = StringRegExpReplace(FileRead("C:Some\Path\File.txt", "(?si)^.*>\h*([[:alnum:]]{12})\h*<.*$", "$1")For a RegEx only then "(?i)>\h*([[:alnum:]]{12})\h*<"EDIT Added a check for horizontal spaces before and after in case of poor html. Edited August 11, 2011 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted August 11, 2011 Share Posted August 11, 2011 Thank you very much this is getting me going. Since I have no idea what ConsoleWrite does now I am on to writing $sText to a file. I appreciate the help and pointing me in the right direction!Run the script from SciTE, the console should be at the bottom, if it isn't, click View > Output (or F8). .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
mrgrosser Posted August 11, 2011 Author Share Posted August 11, 2011 Thank you guys but that just seems to generate more errors. I'm great with software and hardware but my brain just can't wrap around coding. Thanks for the help but I think I stick to the easier stuff for now. 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