Deye Posted January 30, 2022 Share Posted January 30, 2022 (edited) $sPattern first formed by @mikell Now I need it to work just the same but also to skip lines that contain " = GUICtrlCreateDummy()" #include <Array.au3> $sPattern = '(?ims)^\h*(?|(?:local|Global)\h+(\N+)|((?|\$|GUI[cs])\N+))(?=.*GUISetState)' _Read("GUICtrlCreateDummy.au3") _Read("_WinAPI_CallWindowProc.au3") _Read("GUICtrlCreateContextMenu[2].au3") Func _Read($file) Local $sPath = @ProgramFilesDir & "\AutoIt3\Examples\Helpfile\" _ArrayDisplay(StringRegExp(FileRead($sPath & $file), $sPattern, 3)) EndFunc TIA Edit: was a bit impatient posting this: so i just added this to the pattern and it works : .*[= ]\QGUICtrlCreateDummy()\E.*\R?(*SKIP)(?!)| Edited January 30, 2022 by Deye Link to comment Share on other sites More sharing options...
Solution mikell Posted January 30, 2022 Solution Share Posted January 30, 2022 Honestly I can't remember this thing In such cases I personally use a small func to first remove empty lines and lines containing the unwanted string - or several unwanted strings, in this case write them in the $filter param with a separator (here I used a semicolon) #include <Array.au3> $sPattern = '(?ims)^\h*(?|(?:local|Global)\h+(\N+)|((?|\$|GUI[cs])\N+))(?=.*GUISetState)' _Read("GUICtrlCreateDummy.au3") _Read("_WinAPI_CallWindowProc.au3") _Read("GUICtrlCreateContextMenu[2].au3") Func _Read($file) Local $sPath = @ProgramFilesDir & "\AutoIt3\Examples\Helpfile\" $txt = _clean(FileRead($sPath & $file), "GUICtrlCreateDummy()") _ArrayDisplay(StringRegExp($txt, $sPattern, 3)) EndFunc Func _clean($txt, $filter, $separator = ";") $filter = "\Q" & StringReplace($filter, $separator, "\E|\Q") & "\E" Return StringRegExpReplace($txt, '(?m)^(\s*|.*(?:' & $filter & ').*)$\R?', "") EndFunc Deye 1 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