Randolph Posted December 13, 2011 Share Posted December 13, 2011 Good Day, Appreciate some help on this; i've got the below text and i'm trying to replace the "[xx;xxH" patterns before each string. xx is a number that can either be 2 digits or single-digit. I've got the below, but it doesn't appear to work; appreciate any help please; thanks. Code $rel = StringRegExp("[15;1HAdam Biggs", "[(\d{2});(\d{2})H", 'aaaaa') _ArrayDisplay($rel) Sample text to clean: [14;1HAbigail Mulliga[14;17H10366693 [14;31H103-40521[14;45HOther [14;53H12:36[14;60H 0[14;68H 0[14;76H 0[15;1HAdam Biggs [15;17H10366748 [15;31H103-40407[15;45HOther [15;53H12:36[15;60H 0[15;68H 0[15;76H 1[16;1HAdam Rogers [16;17H10366694 [16;31H103-40519[16;45HAUX [16;53H12:38[16;60H 0[16;68H 0[16;76H 0[17;1HAde Mafo [17;17H10366695 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 13, 2011 Moderators Share Posted December 13, 2011 Randolph, Try this one: $sText = "[14;1HAbigail Mulliga[14;17H10366693 [14;31H103-40521[14;45HOther [14;53H12:36[14;60H 0[14;68H 0[14;76H 0[15;1HAdam Biggs [15;17H10366748 [15;31H103-40407[15;45HOther [15;53H12:36[15;60H 0[15;68H 0[15;76H 1[16;1HAdam Rogers [16;17H10366694 [16;31H103-40519[16;45HAUX [16;53H12:38[16;60H 0[16;68H 0[16;76H 0[17;1HAde Mafo [17;17H10366695" $sNewText = StringRegExpReplace($sText, "\[\d+;\d+H", 'aaaaa') ConsoleWrite($sNewText & @CRLF) Any help? M23 P.S. Do you realise you have some non-printing characters in your posted string? 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 Link to comment Share on other sites More sharing options...
Randolph Posted December 13, 2011 Author Share Posted December 13, 2011 Brilliant; that works. Yes i'm aware of the non-printable characters, strangely enough; i can remove them in autoit. Thanks. 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