supersonic Posted April 9, 2009 Share Posted April 9, 2009 Hi everybody! I'm trying to find a way to extract ALL strings between "@"-chars from the following (example) string: "test @sirname@, @username@ - @computername@ - test" This should be the result: 1. "sirname" 2. ", " 3. "username" 4. " - " 5. "computername" I tried to figure out by myself using StringRegExp() or _StringBetween() - without luck... :-( Any ideas? Greets, -supersonic. Link to comment Share on other sites More sharing options...
Marlo Posted April 9, 2009 Share Posted April 9, 2009 Try the StringSplit() function. Click here for the best AutoIt help possible.Currently Working on: Autoit RAT Link to comment Share on other sites More sharing options...
martin Posted April 9, 2009 Share Posted April 9, 2009 Hi everybody! I'm trying to find a way to extract ALL strings between "@"-chars from the following (example) string: "test @sirname@, @username@ - @computername@ - test" This should be the result: 1. "sirname" 2. ", " 3. "username" 4. " - " 5. "computername" I tried to figure out by myself using StringRegExp() or _StringBetween() - without luck... :-( Any ideas? Greets, -supersonic. #include <array.au3> $str1 = "test @sirname@, @username@ - @computername@ - test" $res = StringRegExp($str1,"@(\w*?)@",3) if IsArray($res) then _ArrayDisplay($res) EndIf 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...
picaxe Posted April 9, 2009 Share Posted April 9, 2009 (edited) This works, but needs testing with real data.#include <Array.au3> $sString = "test @sirname@, @username@ - @computername@ - test" $aArray = StringRegExp($sString, '(?U)(?<=@)(\S*)@', 3) _ArrayDisplay($aArray) edit: remove unnecessary .* Edited April 9, 2009 by picaxe Link to comment Share on other sites More sharing options...
supersonic Posted April 21, 2009 Author Share Posted April 21, 2009 Thank you, you helped me out... :-) 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