Aceguy Posted July 8, 2009 Share Posted July 8, 2009 (edited) Hi , having the smae old problem with stringregexpreplace.... this is the string:- Lu. ace / try editOther UsesResale Price: ~1,292 - 1,420 edt would like to filter out words 4+ letter \w{4,} any digit \d+ and any spaces \s* but cant seem to combing the 2... have tried (\w{4,})(\d+)(\s*) (\w{4,})*(\d+)*(\s*) Grrr Edited July 8, 2009 by Aceguy [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock Link to comment Share on other sites More sharing options...
Xenobiologist Posted July 8, 2009 Share Posted July 8, 2009 (edited) $str = 'Lu. ace / try editOther UsesResale Price: ~1,292 - 1,420 edt' ConsoleWrite(StringRegExpReplace($str, '\\w{4,}|\\d', '') & @CRLF) Mega Edit : the f... code or Autoit tags remove the \. the pattern is = \w{4,}|\d Edit 2 : I escaped the \ by another \ Edited July 8, 2009 by Xenobiologist Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Authenticity Posted July 8, 2009 Share Posted July 8, 2009 (edited) #include <Array.au3> Dim $sStr = "Lu. ace / try editOther UsesResale Price: ~1,292 - 1,420 edt" Dim $sPatt = "\\b(?:\\w{4,}|\\d[\\d,]{3,})\\b" Dim $aMatches = StringRegExp($sStr, $sPatt, 3) If IsArray($aMatches) Then _ArrayDisplay($aMatches) The thousands separated numbers is a bit problematic but you can come up with a patter that match thousands separated number strings that it at least 1,000 and bigger. Edited July 8, 2009 by Authenticity Link to comment Share on other sites More sharing options...
Aceguy Posted July 8, 2009 Author Share Posted July 8, 2009 (edited) sorry edited post.... ty so the | means "&" i though it was else... thanks, you live and learn Edited July 8, 2009 by Aceguy [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock Link to comment Share on other sites More sharing options...
Aceguy Posted July 8, 2009 Author Share Posted July 8, 2009 so to remove the ~-:, chars |[~-:,] err no, lol... GRR [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock Link to comment Share on other sites More sharing options...
Xenobiologist Posted July 8, 2009 Share Posted July 8, 2009 Hi, no the | means or which in this case is no problem cause both sides should be replaced by "" (emtpy string). So, the pattern looks for letters included _ with length 4 or higher OR any digit and replaces them with nothing. Mega P.S.: If the numbers within a , or. or both should be completly replaced then you need to expand the pattern a little bit. Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Xenobiologist Posted July 8, 2009 Share Posted July 8, 2009 so to remove the ~-:, chars |[~-:,] err no, lol... GRR why not? $str = 'Lu. ace / try editOther UsesResale Price: ~1,292 - 1,420 edt' ConsoleWrite(StringRegExpReplace($str, '\\w{4,}|\\d|[-~:,]', '') & @CRLF) Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times 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