Jump to content

need help with StringRegExpReplace


Recommended Posts

Hi.

Im trying to replace \ with / with this code

 Local $stringReplace="//something/something"

 Local $stringReplace2=StringRegExpReplace($stringReplace, '/', '\')

but this dosent work, all i get is a string that looks like that "somethingsomething".

Anyone?

Edited by sakej
Link to post
Share on other sites

Hi @sakej:)
Is this what you were looking for?

Global $strString = "//something/moresomething/moremoresomething/"

ConsoleWrite("String before: '" & $strString & "'" & @CRLF & _
             "String after: '" & StringReplace($strString, "/", "\") & "'" & @CRLF)

 

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Link to post
Share on other sites

Hi.

you need to "escape" the "\" in your (one char) replace string:

Local $stringReplace="//something/something"
Local $stringReplace2=StringRegExpReplace($stringReplace, '/', '\\')
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $stringReplace2 = ' & $stringReplace2 & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console

regards, rudi.

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...