BoogY Posted July 1, 2010 Posted July 1, 2010 Hi there to every one ... I need a little help with this string : 'T065066\USERNAME4 T065067\USERNAME3 T065068\USERNAME2 T900160\USERNAME1' How can I extract the T0 or T9 Strings ? I'm rely lost here.. Here is my code : ;Option 1, using offset $nOffset = 1 While 1 $x = 'T065066\USERNAME4 T065067\USERNAME3 T065068\USERNAME2 T900160\USERNAME1' $array = StringRegExp($x, '(tT){1}(0-9)+', 1, $nOffset) If @error = 0 Then $nOffset = @extended Else ExitLoop EndIf for $i = 0 to UBound($array) - 1 msgbox(0, "RegExp Test with Option 1 - " & $i, $array[$i]) Next WEnd
BoogY Posted July 1, 2010 Author Posted July 1, 2010 Whel I fount 'it $array = StringRegExp($x, '(?i)t[0-9]+', 1, $nOffset)
UEZ Posted July 1, 2010 Posted July 1, 2010 This is my version: #include <Array.au3> ;Option 1, using offset $nOffset = 1 ;~ While 1 $x = 'T065066\USERNAME4 T065067\USERNAME3 T065068\USERNAME2 T900160\USERNAME1' $array = StringRegExp($x, '(T0[\d]+|T9[\d]+)\\', 3, $nOffset) If @error = 0 Then $nOffset = @extended Else ExitLoop EndIf _ArrayDisplay($array) ;~ WEnd BR, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
BoogY Posted July 1, 2010 Author Posted July 1, 2010 (edited) This is my version: #include <Array.au3> ;Option 1, using offset $nOffset = 1 ;~ While 1 $x = 'T065066\USERNAME4 T065067\USERNAME3 T065068\USERNAME2 T900160\USERNAME1' $array = StringRegExp($x, '(T0[\d]+|T9[\d]+)\\', 3, $nOffset) If @error = 0 Then $nOffset = @extended Else ExitLoop EndIf _ArrayDisplay($array) ;~ WEnd BR, UEZ Nice but if there is a small T (t) it will not take it But this one will work = '(?i)(T0[\d]+|T9[\d]+)\\' Edited July 1, 2010 by BoogY
Mat Posted July 1, 2010 Posted July 1, 2010 (edited) #include <Array.au3> $nOffset = 1 $x = 'T065066\USERNAME4 T065067\USERNAME3 T065068\USERNAME2 T900160\USERNAME1' $array = StringRegExp($x, '(?i)(T0[\d]+|T9[\d]+)\\', 3, $nOffset) If @error = 0 Then $nOffset = @extended Else Exit EndIf _ArrayDisplay($array) Too slow... He got to the flag first Edited July 1, 2010 by Mat AutoIt Project Listing
GEOSoft Posted July 1, 2010 Posted July 1, 2010 (edited) "(?i)(t[09]\d+)" Edited July 1, 2010 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!"
BoogY Posted July 1, 2010 Author Posted July 1, 2010 #include <Array.au3> $nOffset = 1 $x = 'T065066\USERNAME4 T065067\USERNAME3 T065068\USERNAME2 T900160\USERNAME1' $array = StringRegExp($x, '(?i)(T0[\d]+|T9[\d]+)\\', 3, $nOffset) If @error = 0 Then $nOffset = @extended Else Exit EndIf _ArrayDisplay($array) Too slow... He got to the flag first I have a question = Why the flag 3 ?
GEOSoft Posted July 1, 2010 Posted July 1, 2010 (edited) To get all of the t######### combinations in an array I also made a typo in the one I posted and the editor is screwing me around to day. It should be "(?i)(t[09]\d+)" Edited July 1, 2010 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!"
BoogY Posted July 1, 2010 Author Posted July 1, 2010 Thanks I saw the typing error no problem... It works
GEOSoft Posted July 1, 2010 Posted July 1, 2010 Thanks I saw the typing error no problem...It works If you need to test SREs, look in my signature for the PCRE Toolkit. 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!"
BoogY Posted July 1, 2010 Author Posted July 1, 2010 If you need to test SREs, look in my signature for the PCRE Toolkit.Thanks a lot
BoogY Posted July 1, 2010 Author Posted July 1, 2010 Ok I have a problem .. This one works great "(?i)(t[09]\d+" but if I put this strig for example (T065066\USERNAME4 T065067\USERNAME3 T065068\USERNAME2 t900160\USERNAME1 t065066\USERNAME4) It gives me back juste 4 items ??!!! why not all of them ?? the first one is not geting back to me !!!!
JohnOne Posted July 1, 2010 Posted July 1, 2010 #include <Array.au3> $x = 'T065066\USERNAME4 T065067\USERNAME3 T065068\USERNAME2 T900160\USERNAME1 T065068\USERNAME2 T065068\USERNAME2 T065068\USERNAME2' $array1 = StringSplit($x, ' ', 2) Local $array2[UBound($array1)][2] For $i = 0 To UBound($array1) -1 $atemp = StringSplit($array1[$i],"\",2) $array2[$i][0] = $atemp[0] $array2[$i][1] = $atemp[1] Next _ArrayDisplay($array2) AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
jchd Posted July 1, 2010 Posted July 1, 2010 Don't forget AutoIt array are zero-based. The output is good: #include <Array.au3> Local $x = 'T065066\USERNAME4 T065067\USERNAME3 t065068\USERNAME2 T900160\USERNAME1' Local $array = StringRegExp($x, '(?i)(T[09]\d+)\\([^\s]+)', 3) _ArrayDisplay($array) Local $array2[UBound($array) / 2][2] For $i = 0 To (UBound($array) / 2) - 1 $array2[$i][0] = $array[2 * $i] $array2[$i][1] = $array[2 * $i + 1] Next _ArrayDisplay($array2) This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
GEOSoft Posted July 1, 2010 Posted July 1, 2010 Testing it with the toolkit would have shown you what was happening. 0 based array 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!"
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