Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
获取存储在Powershell数组中的HTML代码以检索特定字符串 标题在这里_Html_Arrays_Regex_Powershell - Fatal编程技术网

获取存储在Powershell数组中的HTML代码以检索特定字符串 标题在这里

获取存储在Powershell数组中的HTML代码以检索特定字符串 标题在这里,html,arrays,regex,powershell,Html,Arrays,Regex,Powershell,此处段落 嗨 我试图仅从获取中的值。我该怎么做呢 上面只是一段代码,我使用webClient.DownloadString($URL)获取上面的内容。 什么powershell命令只能获得以下输出? 此处的标题使用如下函数 $>获取标题 这将获得网页的源代码,并使用正则表达式剪切和之外的所有内容 函数获取标题{ 参数([string]$url) $webClient=新对象System.Net.webClient $data=$webClient.downloadstring($url)

此处段落

我试图仅从
获取
中的值。我该怎么做呢

上面只是一段代码,我使用webClient.DownloadString($URL)获取上面的内容。 什么powershell命令只能获得以下输出? 此处的标题

使用如下函数 $>获取标题

这将获得网页的源代码,并使用正则表达式剪切

之外的所有内容

函数获取标题{
参数([string]$url)
$webClient=新对象System.Net.webClient
$data=$webClient.downloadstring($url)
$title=[regex]'(?
<div class="primary-title-and-description">
    <h1>
        Title Here
    </h1>

    <p>
        Paragraph Here
    </p>
</div>