0

I am moving aspx files from an old system to the new one using Powershell. I need to parse the page and change href of hyperlink tags as following.

old system
href=/ranet/templates/page____9372.aspx

will be in new system

/newfolder/folder1/9372.aspx

2
  • I used replace method to replace href value. but I need to have a common solution to find all /.../page____number and replace it with /new.../number Commented Dec 5, 2013 at 13:50
  • Post your code so we've got a starting point. Commented Dec 5, 2013 at 13:54

1 Answer 1

2

Try this

$input = "href=/ranet/templates/page____9372.aspx"
$new = "/newfolder/folder1/"
$array = $input.Split('_')
$array2 = ($array[$array.Count-1]).Split('.')
$newLine = $new+$array2[0]+".aspx"
$input
$newLine

Actually this is not such a great answer as you have to ensure that there are no other underline characters in the page!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.