Bliss 194 Posted January 14, 2012 Report Share Posted January 14, 2012 Hi all, I am new to RegEx always stayed away from it (don't know why). Anyway it's come the time i need to use it for things, so the past week i have been messing about with it in some bots. I've come across a problem, I have a list of items in a list now out of that list i want to grab all the numbers only so i use set(#Hk, $find regular expression(%RHID, "\\d"), "Global") which does put all the numbers out the list %RHID into the variable #Hk BUT it puts 1 number per line. I want all these numbers as a large string. I have tried using \r but im not sure exactly how to do it. I even looked at RegExBuddy but couldn't find out in there how to do it either. Can anyone help please? Thanx in advance Jane Quote Link to post Share on other sites
JohnB 255 Posted January 14, 2012 Report Share Posted January 14, 2012 Hi Jane. Can you give an example url so I can take a look? You may be able to do something as simple as replace a new line with a space (if you need a space) or nothing if you don't. John Quote Link to post Share on other sites
Bliss 194 Posted January 14, 2012 Author Report Share Posted January 14, 2012 Hi Jane. Can you give an example url so I can take a look? You may be able to do something as simple as replace a new line with a space (if you need a space) or nothing if you don't. John Hi John, It's not a url, Im reading it from a csv file into a list. Here is a cut down example of the list items and then how the variable looks in the debugger. (9): SoundDevice, Caption = Realtek High Definition Audio; ConfigManagerErrorCode = 0; ConfigManagerUserConfig = False; CreationClassName = Win32_SoundDevice; Description = Realtek High Definition Audio; DeviceID = HDAUDIO\FUNC_01&VEN_10EC&DEV_0889&SUBSYS_10250146&REV_1000\4&333E2D5D&0&0001; Manufacturer = Realtek; Name = Realtek High Definition Audio; PNPDeviceID = HDAUDIO\FUNC_01&VEN_10EC&DEV_0889&SUBSYS_10250146&REV_1000\4&333E2D5D&0&0001; PowerManagementSupported = False; ProductName = Realtek High Definition Audio; Status = OK; StatusInfo = 3; SystemCreationClassName = Win32_ComputerSystem; SystemName = LAPPY; Caption = NVIDIA HDMI Audio; ConfigManagerErrorCode = 0; ConfigManagerUserConfig = False; CreationClassName = Win32_SoundDevice; Description = NVIDIA HDMI Audio; DeviceID = HDAUDIO\FUNC_01&VEN_10DE&DEV_0006&SUBSYS_10DE0101&REV_1000\4&333E2D5D&0&0201; Manufacturer = NVIDIA; Name = NVIDIA HDMI Audio; PNPDeviceID = HDAUDIO\FUNC_01&VEN_10DE&DEV_0006&SUBSYS_10DE0101&REV_1000\4&333E2D5D&0&0201; PowerManagementSupported = False; ProductName = NVIDIA HDMI Audio; Status = OK; StatusInfo = 3; SystemCreationClassName = Win32_ComputerSystem; SystemName = LAPPY(10): DesktopMonitor, Availability = 3; Caption = Generic PnP Monitor; ConfigManagerErrorCode = 0; ConfigManagerUserConfig = False; CreationClassName = Win32_DesktopMonitor; Description = Generic PnP Monitor; DeviceID = DesktopMonitor1; MonitorManufacturer = (Standard monitor types); MonitorType = Generic PnP Monitor; Name = Generic PnP Monitor; PixelsPerXLogicalInch = 120; PixelsPerYLogicalInch = 120; PNPDeviceID = DISPLAY\SEC304C\5&16FD7C7&0&UID272; ScreenHeight = 768; ScreenWidth = 1280; Status = OK; SystemCreationClassName = Win32_ComputerSystem; SystemName = LAPPY(12): MemoryDevice, Caption = Memory Device; CreationClassName = Win32_MemoryDevice; Description = Memory Device; DeviceID = Memory Device 0; EndingAddress = 2097151; ErrorInfo = 3; Name = Memory Device; StartingAddress = 0; SystemCreationClassName = Win32_ComputerSystem; SystemName = LAPPY; Caption = Memory Device; CreationClassName = Win32_MemoryDevice; Description = Memory Device; DeviceID = Memory Device 1; EndingAddress = 2097151; ErrorInfo = 3; Name = Memory Device; StartingAddress = 0; SystemCreationClassName = Win32_ComputerSystem; SystemName = LAPPY #Hk: 3322023210110203203 so I want the numbers returned to be in 1 string on one line for example 12345567 and not how they are above 1 per line. Hope I explained it ok? Jane Quote Link to post Share on other sites
JohnB 255 Posted January 14, 2012 Report Share Posted January 14, 2012 I'm not positive I follow, but you can do something like this: set(#list, "322023210110203203", "Global")set(#list, $replace($list from text(#list, $new line), $new line, $nothing), "Global") John Quote Link to post Share on other sites
Bliss 194 Posted January 14, 2012 Author Report Share Posted January 14, 2012 I'm not positive I follow, but you can do something like this: set(#list, "322023210110203203", "Global")set(#list, $replace($list from text(#list, $new line), $new line, $nothing), "Global") John Thanks john, That did the trick. I didn't even think about doing it in ubot ..lol Thanks again Jane Quote Link to post Share on other sites
JohnB 255 Posted January 14, 2012 Report Share Posted January 14, 2012 lol...great! There's a lot you can do in UBot! http://ubotstudio.com/forum/public/style_emoticons/default/smile.gif John Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.