John117 Posted July 27, 2015 Share Posted July 27, 2015 Hey, I'm not that great with String Replace or String Strip where the exact string is not known. I need to be able to strip the following:"2015">2015Where 2015 may not be known. I need to basically strip the side "*> where * behaves like a wild card and leaves only the right side 2015.Length will not be known. It will not always be numerical.It may be " * > or < * > but I can set these for each column according to which way it is set up. Please help. Just need a basic understanding of how to identify and replace the pattern with "" Link to comment Share on other sites More sharing options...
jguinch Posted July 27, 2015 Share Posted July 27, 2015 Can you provide some other examples of possible strings ?If I understand, you want to keep only the last digits, am I right ?$string = '"2015">2015' $newstring = StringRegExpReplace($string, ".+?(\d+)$", "$1") ConsoleWrite($newstring) Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
mikell Posted July 27, 2015 Share Posted July 27, 2015 ...or remove all up to the last ">" (included) ?$string = '"2014">2015' $newstring = StringRegExpReplace($string, ".*>", "") ConsoleWrite($newstring) Link to comment Share on other sites More sharing options...
John117 Posted July 27, 2015 Author Share Posted July 27, 2015 Thanks for your reply. Here are a few examples. <span title="111">111 <span title="3.5L 6 cyl Fuel Injection">3.5L 6 cyl Fuel Injection <span title="Ultra White">Ultra White <span title="Black/garnet">Black/garnet Link to comment Share on other sites More sharing options...
John117 Posted July 27, 2015 Author Share Posted July 27, 2015 This is what I have so far. Yours works great for the numerical portions.StringReplace(StringRegExpReplace($Array2[0], "\>.*", ""), '"', "") Link to comment Share on other sites More sharing options...
John117 Posted July 27, 2015 Author Share Posted July 27, 2015 Ok so using your code I've been able to clear everything except " title="$44,900" StringReplace(StringRegExpReplace($Array2[0], ".*>", ""), '"', "") Link to comment Share on other sites More sharing options...
jguinch Posted July 27, 2015 Share Posted July 27, 2015 StringRegExpReplace($Array2[0], '<\V+title="([^"]+)".+', "$1") Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
John117 Posted July 27, 2015 Author Share Posted July 27, 2015 StringRegExpReplace($Array2[0], '<\V+title="([^"]+)".+', "$1") $string = 'title="$44,900"'$String2 = StringRegExpReplace($string, '<\V+title="([^"]+)".+', "$1")Consolewrite($String2 & @CRLF) Doesn't look like that one works. Link to comment Share on other sites More sharing options...
jguinch Posted July 27, 2015 Share Posted July 27, 2015 You can use $string = '<span title="$44,900">$44,900' directly Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
John117 Posted July 27, 2015 Author Share Posted July 27, 2015 Thanks for the reply. That one's not set up like that. In that case $Array2[0] is title="$44,900" Link to comment Share on other sites More sharing options...
John117 Posted July 27, 2015 Author Share Posted July 27, 2015 This is what I am using on that single one for now. StringStripWS(StringReplace(StringReplace($Array2[0], 'title="$', ''), '"', ''), $STR_STRIPALL) 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