Jump to content
Sign in to follow this  

Help in stringregexreplace please?

Recommended Posts

please, anyone help me?

i trying this 2 hours and nothing x.x

i need to transform this:




i tryed this:

StringRegExpReplace("http://www.mysite.com/default.asp?my-category" , "([^.?]+[^.?/])", "$1$2")

and others, but... nothing x.x

anyone help me please? thanks a lot!


i tryed:

StringRegExpReplace("http://www.mysite.com/default.asp?my-category", "(/default\.asp\??)", "/")

and it works

sorry for the post and thanks all =)

Edited by darkshark

Share this post

Link to post
Share on other sites

$in = "http://www.mysite.com/default.asp?my-category"
$expected = "http://www.mysite.com/my-category/"

$real = UrlTransform($in)

If $real = $expected Then
    ConsoleWrite("URL transform: Test succesful" & @CRLF)
    ConsoleWrite("! URL transform: Test failed. Expected: " & $expected & " got: " & $real & @CRLF)

Func UrlTransform($url)
    Return StringReplace($url, "default.asp?", "") & "/"

Free unit test included.

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...