MarioX Posted April 16, 2007 Share Posted April 16, 2007 (edited) I'm looking for assistance in finding correct RegExp syntiax. I need to strip out html code from a string like the following: CODE<tr><td align=right nowrap>&-nbsp 16 Apr 2007 </td> Leaving only the date 16 Apr 2007 The below code work fine stripping out everything except the &-nbsp. How to do this ? CODE$input="<tr><td align=right nowrap> &-nbsp 15 Apr 2007 </td>" $output = StringRegExpReplace($input, '(?s)(?i)\<[^\>]*\>', '') MsgBox(0,"Result",$output) Note: The real word to remove is &-nbsp without the - , Posting without - clear the code Thanking in advance for any help Edited April 16, 2007 by MarioX Link to comment Share on other sites More sharing options...
BrettF Posted April 16, 2007 Share Posted April 16, 2007 I'm looking for assistance in finding correct RegExp syntiax. I need to strip out html code form a string like the following: <tr><td align=right nowrap> 15 Apr 2007 </td> The below code work fine leaving the date 15 Apr 2007 but it don't get rid of ' ' . How to do this ? CODE$input="<tr><td align=right nowrap> 15 Apr 2007 </td>" $output = StringRegExpReplace($input, '(?s)(?i)\<[^\>]*\>', '') MsgBox(0,"Result",$output) Thanking in advance for any helpum... where is the ? I know what it is and all... I just can't see it Other than that it worked fine Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
MarioX Posted April 16, 2007 Author Share Posted April 16, 2007 um... where is the ? I know what it is and all... I just can't see it Other than that it worked fine I agree, when I post the message, my code is formatted and the &-nbsp (without -) is cleared... Link to comment Share on other sites More sharing options...
BrettF Posted April 16, 2007 Share Posted April 16, 2007 I agree, when I post the message, my code is formatted and the &-nbsp (without -) is cleared...Ahh... ok so i ad the at the end before </td>>> Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
MarioX Posted April 16, 2007 Author Share Posted April 16, 2007 Ahh... ok so i ad the at the end before </td>>>The string to clean is the following:<tr><td align=right nowrap>  16 Apr 2007 </td>Thanks again for help! Link to comment Share on other sites More sharing options...
BrettF Posted April 16, 2007 Share Posted April 16, 2007 The string to clean is the following: <tr><td align=right nowrap>  16 Apr 2007 </td> Thanks again for help! Um not really sure on StringRegExpReplace, but string replace should do the trick: This worked well: $input="<tr><td align=right nowrap>  16 Apr 2007 </td>" $output = StringRegExpReplace($input, '(?s)(?i)\<[^\>]*\>', '') $output = StringReplace ($output, " ", "") MsgBox(0,"Result",$output) Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
MarioX Posted April 16, 2007 Author Share Posted April 16, 2007 Um not really sure on StringRegExpReplace, but string replace should do the trick: This worked well: $input="<tr><td align=right nowrap>  16 Apr 2007 </td>" $output = StringRegExpReplace($input, '(?s)(?i)\<[^\>]*\>', '') $output = StringReplace ($output, " ", "") MsgBox(0,"Result",$output) It work, thanks for the suggestion! 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