tony01 Posted January 27, 2007 Share Posted January 27, 2007 Hi erverybody: I am playing with the StringRegExpReplace function and I want to replace the character "P" with spaces from the string "P20" and the result should be just the the number 20. This is my script : CODE $sRange = "P20" $nElement = Number(StringRegExpReplace($sRange, "([a-z][A-Z])", " ")) MsgBox(0, "Range", $sRange & " " & $nElement ) I got as a result 0 , instead of 20. What is Wrong?? Please help. Thanks a lot. Link to comment Share on other sites More sharing options...
Uten Posted January 27, 2007 Share Posted January 27, 2007 (edited) What does this show: $sRange = "P20" $nElement = StringRegExpReplace($sRange, "([a-z][A-Z])", " ") MsgBox(0, "Range", $sRange & " " & $nElement ) EDIT: Then try this: StringRegExpReplace($sRange, "[a-zA-Z]", " ") or $sRange = "pP20" Edited January 27, 2007 by Uten Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
tony01 Posted January 27, 2007 Author Share Posted January 27, 2007 Uten : Excellent, Now It works . Thanks very much Uten. 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