wisem2540 Posted September 24, 2014 Posted September 24, 2014 I have a block of text, as follows File-based write filter configuration for the current session: filter state: enabled. overlay cache data compression state: enabled. overlay cache threshold: 128 MB. overlay cache pre-allocation: disabled. size display: actual mode. protected volume list: (none) write through list of each protected volume: File-based write filter configuration for the next session: filter state: enabled. overlay cache data compression state: enabled. overlay cache threshold: 128 MB. overlay cache pre-allocation: disabled. size display: actual mode. protected volume list: (none) write through list of each protected volume: All I want to return is Current session filter state, like this piece... File-based write filter configuration for the current session: filter state: enabled. I figure I could end at the period after "Enabled" So I tried this... File-based write filter configuration for the current session:([^/]+)\. However, this returns all the way to file FINAL period in the block of text. I want it to stop at the FIRST period. Can anyone help?
jguinch Posted September 24, 2014 Posted September 24, 2014 (edited) Something like this ? #Include <Array.au3> $sText = "File-based write filter configuration for the current session:" & @CRLF & _ "filter state: enabled." & @CRLF & _ "overlay cache data compression state: enabled." & @CRLF & _ "overlay cache threshold: 128 MB." & @CRLF & _ "overlay cache pre-allocation: disabled." & @CRLF & _ "size display: actual mode." & @CRLF & _ "protected volume list: (none)" & @CRLF & _ "write through list of each protected volume:" & @CRLF & _ @CRLF & _ "File-based write filter configuration for the next session:" & @CRLF & _ "filter state: enabled." & @CRLF & _ "overlay cache data compression state: enabled." & @CRLF & _ "overlay cache threshold: 128 MB." & @CRLF & _ "overlay cache pre-allocation: disabled." & @CRLF & _ "size display: actual mode." & @CRLF & _ "protected volume list: (none)" & @CRLF & _ "write through list of each protected volume:" ConsoleWrite($sText) $aFilterSession = StringRegExp($sText, "(?i)File-based write filter configuration for the current session:\R\h*filter state:\h*([^.]+)", 1) ; or ; $aFilterSession = StringRegExp($sText, "(?is)current session:.+?((?:en|dis)+abled)", 1) ; or ... else ... _ArrayDisplay($aFilterSession) Edited September 24, 2014 by jguinch Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF
Moderators Melba23 Posted September 24, 2014 Moderators Posted September 24, 2014 wisem2540,Or perhaps this: $sText = "File-based write filter configuration for the current session:" & @CRLF & _ "filter state: enabled." & @CRLF & _ "overlay cache data compression state: enabled." & @CRLF & _ "overlay cache threshold: 128 MB." & @CRLF & _ "overlay cache pre-allocation: disabled." & @CRLF & _ "size display: actual mode." & @CRLF & _ "protected volume list: (none)" & @CRLF & _ "write through list of each protected volume:" & @CRLF & _ @CRLF & _ "File-based write filter configuration for the next session:" & @CRLF & _ "filter state: enabled." & @CRLF & _ "overlay cache data compression state: enabled." & @CRLF & _ "overlay cache threshold: 128 MB." & @CRLF & _ "overlay cache pre-allocation: disabled." & @CRLF & _ "size display: actual mode." & @CRLF & _ "protected volume list: (none)" & @CRLF & _ "write through list of each protected volume:" $sFilterSession = StringRegExpReplace($sText, "(?Us)^(.*\.).*$", "$1") ConsoleWrite($sFilterSession & @CRLF)M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Solution mikell Posted September 24, 2014 Solution Posted September 24, 2014 (edited) $sFilterSession = StringRegExp($sText, "(?is)current.*?state:\h*([^.]+)", 1)[0] Msgbox(0,"", $sFilterSession) Edited September 24, 2014 by mikell
wisem2540 Posted September 25, 2014 Author Posted September 25, 2014 I used Mikell's example. Thank you all!
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