Sign in to follow this  
Followers 0
tony01

StringRegExpReplace problem

3 posts in this topic

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.

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by Uten

Share this post


Link to post
Share on other sites

Uten :

Excellent, Now It works .

Thanks very much Uten.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0