[英]parsing string using powershell
I am moving aspx files from an old system to the new one using Powershell. 我正在使用Powershell将旧系统中的aspx文件移动到新系统。 I need to parse the page and change href of hyperlink tags as following.
我需要解析页面并更改超链接标签的href,如下所示。
old system 旧系统
href=/ranet/templates/page____9372.aspx HREF = / RANET /模板/页____ 9372.aspx
will be in new system 将在新系统中
/newfolder/folder1/9372.aspx /newfolder/folder1/9372.aspx
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! 实际上这不是一个很好的答案,因为你必须确保页面中没有其他下划线字符!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.