Jump to content

StringRegExpReplace problem


tony01
 Share

Recommended Posts

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

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...