d112 Posted March 4, 2017 Share Posted March 4, 2017 Hi everyone, I'd like to ask here my question because I tried myself without success with StringRegExp for the last 2 hours I have a string like this: " abc defgh jklm " and I want to return an array like this: $array[0]="abc" $array[1]="defgh" $array[2]="jklm" Can anyone give me some help please? Link to comment Share on other sites More sharing options...
benners Posted March 4, 2017 Share Posted March 4, 2017 (edited) #include <array.au3> #include <StringConstants.au3> $s_Test = " abc defgh jklm " $as_Array = StringRegExp($s_Test, '[a-z]{3,}', $STR_REGEXPARRAYGLOBALMATCH) _ArrayDisplay($as_Array) Edited March 4, 2017 by benners Link to comment Share on other sites More sharing options...
jguinch Posted March 4, 2017 Share Posted March 4, 2017 StringRegExp($string, "\H+", 3) Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
d112 Posted March 4, 2017 Author Share Posted March 4, 2017 thank you, it works I only changed [a-z] with [a-z,A-Z,0-9] Link to comment Share on other sites More sharing options...
benners Posted March 4, 2017 Share Posted March 4, 2017 4 minutes ago, d112 said: thank you, it works I only changed [a-z] with [a-z,A-Z,0-9] If you use the code that jguinch left, you don't have to bother with that. It will match anything that isn't a space. It's better than mine. Link to comment Share on other sites More sharing options...
iamtheky Posted March 4, 2017 Share Posted March 4, 2017 unless there are other criteria, with no regex: #include<array.au3> $s_Test = " abc defgh jklm " _ArrayDisplay(stringsplit(stringstripws($s_Test , 3) , " " , 2)) ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) 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