nullschritt Posted February 7, 2014 Share Posted February 7, 2014 I was wondering if it is possible (preferably with regex) to search for a string in any order. So for example the string 101 would search for 011, 110, 101. Link to comment Share on other sites More sharing options...
czardas Posted February 7, 2014 Share Posted February 7, 2014 (edited) Yes, well kind of. Using regexp with "[abc]+" will match b ab bac bbbbbbbbbbbbbbbbbb accc. An exact match with the same number of characters is going to involve some additional steps. Interesting to think about. Regexp might not be the best way to approach this. If you search for anagram you might find some scripts which will help you. BTW this is the wrong forum. Ask to have this topic moved to Help and Support. Edited February 7, 2014 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
Malkey Posted February 7, 2014 Share Posted February 7, 2014 An example. #include <Array.au3> Local $sTestString = "1001001101010101011010100" Local $sString = "101" ;------------ Create Reg Exp Pattern ---------------- Local $aArray = StringSplit($sString, "", 2) Local $aNewArray = _ArrayPermute($aArray, "") $aNewArray = _ArrayUnique($aNewArray, 1, 1, 0, 0) ;_ArrayDisplay($aNewArray, "Array Permuted") Local $sRegExpPattern = "(" & _ArrayToString($aNewArray, "|") & ")" ConsoleWrite($sRegExpPattern & @LF) ;---------> End of Create Reg Exp Pattern ------------ Local $aResults = StringRegExp($sTestString, $sRegExpPattern, 3) _ArrayDisplay($aResults) czardas 1 Link to comment Share on other sites More sharing options...
nullschritt Posted February 7, 2014 Author Share Posted February 7, 2014 Oh crap, looks liek I posted asking for help in example scripts. My bad guys, had a total brain fart... 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