{"id":3673,"date":"2014-02-10T12:24:40","date_gmt":"2014-02-10T17:24:40","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=3673"},"modified":"2014-02-10T12:24:40","modified_gmt":"2014-02-10T17:24:40","slug":"convert-text-to-object-with-powershell-and-regular-expressions","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3673\/convert-text-to-object-with-powershell-and-regular-expressions\/","title":{"rendered":"Convert Text to Object with PowerShell and Regular Expressions"},"content":{"rendered":"<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/squarepattern.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-thumbnail wp-image-2215\" alt=\"squarepattern\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/squarepattern-150x150.png\" width=\"150\" height=\"150\" \/><\/a>A few weeks ago I was getting more familiar with named captures in regular expressions. With a named capture, you can give your matches meaningful names which makes it easier to access specific captures. The capture is done by prefixing your regular expression pattern with a name.<\/p>\n<pre class=\"lang:batch decode:true\">PS C:\\&gt; \"UNC is \\\\server01\\public\" -match \"\\\\\\\\(?&lt;servername&gt;\\w+)\\\\(?&lt;sharename&gt;\\w+)\"\r\nTrue\r\nPS C:\\&gt; $matches\r\n\r\nName                           Value\r\n----                           -----\r\nservername                     server01\r\nsharename                      public\r\n0                              \\\\server01\\public<\/pre>\n<p>When you know the name, you can get the value from $matches.<\/p>\n<pre class=\"lang:batch decode:true\">PS C:\\&gt; $matches.servername\r\nserver01\r\nPS C:\\&gt; $matches.sharename\r\npublic<\/pre>\n<p>This also works, and even a bit better, using a REGEX object.<\/p>\n<pre class=\"lang:batch decode:true\">PS C:\\&gt; [regex]$rx=\"\\\\\\\\(?&lt;servername&gt;\\w+)\\\\(?&lt;sharename&gt;\\w+)\"\r\nPS C:\\&gt; $rx.Matches(\"UNC is \\\\server01\\public\")\r\n\r\nGroups   : {\\\\server01\\public, server01, public}\r\nSuccess  : True\r\nCaptures : {\\\\server01\\public}\r\nIndex    : 7\r\nLength   : 17\r\nValue    : \\\\server01\\public\r\n\r\nPS C:\\&gt; $rx.Matches(\"UNC is \\\\server01\\public\").groups\r\n\r\nGroups   : {\\\\server01\\public, server01, public}\r\nSuccess  : True\r\nCaptures : {\\\\server01\\public}\r\nIndex    : 7\r\nLength   : 17\r\nValue    : \\\\server01\\public\r\n\r\nSuccess  : True\r\nCaptures : {server01}\r\nIndex    : 9\r\nLength   : 8\r\nValue    : server01\r\n\r\nSuccess  : True\r\nCaptures : {public}\r\nIndex    : 18\r\nLength   : 6\r\nValue    : public<\/pre>\n<p>With the REGEX object you can get the names.<\/p>\n<pre class=\"lang:batch decode:true\">PS C:\\&gt; $rx.GetGroupNames()\r\n0\r\nservername\r\nsharename\r\nPS C:\\&gt; $rx.GetGroupNames() | where {$_ -notmatch \"\\d+\"}\r\nservername\r\nsharename<\/pre>\n<p>Because the names include index numbers, I usually filter them out. Once I know the names, I can use them to extract the relevant matches.<\/p>\n<pre class=\"lang:batch decode:true\">PS C:\\&gt; $rx.Matches(\"UNC is \\\\server01\\public\") | foreach {$_.groups[\"servername\"].value; $_.groups[\r\n\"sharename\"].value}\r\nserver01\r\npublic<\/pre>\n<p>Then I realized it wouldn't take much to take this to the next step in PowerShell. I have a name and a value, why not create an object? It isn't too difficult to create a hashtable on the fly and use that to create a custom object. Eventually I came up with ConvertFrom-Text.<\/p>\n<pre class=\"lang:ps decode:true\">#requires -version 3.0\r\n\r\nFunction ConvertFrom-Text {\r\n\r\n&lt;#\r\n.SYNOPSIS\r\nConvert structured text to objects.\r\n.DESCRIPTION\r\nThis command will take structured text such as from a log file and convert it\r\nto objects that you can use in the PowerShell pipeline. You can specify the\r\npath to a text file, or pipe content directly into this command. The piped\r\ncontent could even be output from command-line tools. You have to specify a\r\nregular expression pattern that uses named captures. See examples.\r\n.PARAMETER Pattern\r\nA regular expression pattern that uses named captures. This parameter has an\r\nalias of Regex.\r\n.PARAMETER Path\r\nThe filename and path to the text or log file.\r\n.PARAMETER Inputobject\r\nAny text that you want to pipe into this command. It can be a certain number\r\nof lines from a large text or log file. Or the output of a command line tool.\r\n.EXAMPLE\r\nPS C:\\&gt; $b = \"(?&lt;Date&gt;\\d{2}-\\d{2}-\\d{4}\\s\\d{2}:\\d{2}).*(?&lt;Error&gt;\\d+),\\s+(?&lt;Step&gt;.*):\\s+(?&lt;Action&gt;\\w+),\\s+(?&lt;Path&gt;(\\w+\\\\)*\\w+\\.\\w+)\"\r\nPS C:\\&gt; convertfrom-text -pattern $b -path C:\\windows\\DtcInstall.log\r\n\r\nDate   : 10-18-2013 10:49\r\nError  : 0\r\nStep   : CMsdtcUpgradePlugin::PostApply\r\nAction : Enter\r\nPath   : com\\complus\\dtc\\dtc\\msdtcstp\\msdtcplugin.cpp\r\n\r\nDate   : 10-18-2013 10:49\r\nError  : 0\r\nStep   : CMsdtcUpgradePlugin::PostApply\r\nAction : Exit\r\nPath   : com\\complus\\dtc\\dtc\\msdtcstp\\msdtcplugin.cpp\r\n...\r\n\r\nThe first command creates a variable to hold the regular expression pattern\r\nthat defines named captures for content in the DtcInstall.log. The second line\r\nruns the command using the pattern and the log file.\r\n.EXAMPLE\r\nPS C:\\&gt; $wu = \"(?&lt;Date&gt;\\d{4}-\\d{2}-\\d{2})\\s+(?&lt;Time&gt;(\\d{2}:)+\\d{3})\\s+(?&lt;PID&gt;\\d+)\\s+(?&lt;TID&gt;\\w+)\\s+(?&lt;Component&gt;\\w+)\\s+(?&lt;Message&gt;.*)\"\r\nPS C:\\&gt; $out = ConvertFrom-Text -pattern $wu -path C:\\Windows\\WindowsUpdate.log\r\nPS C:\\&gt; $out | group Component | Sort Count\r\n\r\nCount Name                      Group\r\n----- ----                      -----\r\n   20 DtaStor                   {@{Date=2014-01-27; Time=07:19:19:584; PID=1...\r\n   72 Setup                     {@{Date=2014-01-27; Time=07:19:05:868; PID=1...\r\n  148 SLS                       {@{Date=2014-01-27; Time=07:19:05:086; PID=1...\r\n  150 PT                        {@{Date=2014-01-27; Time=07:19:08:946; PID=1...\r\n  209 WuTask                    {@{Date=2014-01-26; Time=20:05:28:483; PID=1...\r\n  256 EP                        {@{Date=2014-01-26; Time=21:21:23:341; PID=1...\r\n  263 Handler                   {@{Date=2014-01-27; Time=07:19:42:878; PID=3...\r\n  837 Report                    {@{Date=2014-01-26; Time=21:21:23:157; PID=1...\r\n  900 IdleTmr                   {@{Date=2014-01-26; Time=21:21:23:338; PID=1...\r\n  903 Service                   {@{Date=2014-01-26; Time=20:05:29:104; PID=1...\r\n  924 Misc                      {@{Date=2014-01-26; Time=21:21:23:033; PID=1...\r\n 1062 DnldMgr                   {@{Date=2014-01-26; Time=21:21:23:159; PID=1...\r\n 2544 AU                        {@{Date=2014-01-26; Time=19:55:27:449; PID=1...\r\n 2839 Agent                     {@{Date=2014-01-26; Time=21:21:23:045; PID=1...\r\n\r\nPS C:\\&gt; $out | where {[datetime]$_.date -ge [datetime]\"2\/10\/2014\" -AND $_.component -eq \"AU\"} | Format-Table Date,Time,Message -wrap\r\n\r\nDate       Time         Message\r\n----       ----         -------\r\n2014-02-10 05:36:44:183 ###########  AU: Initializing Automatic Updates  ###########\r\n2014-02-10 05:36:44:184 Additional Service {117CAB2D-82B1-4B5A-A08C-4D62DBEE7782} with Approval\r\n                        type {Scheduled} added to AU services list\r\n2014-02-10 05:36:44:184 AIR Mode is disabled\r\n2014-02-10 05:36:44:185 # Approval type: Scheduled (User preference)\r\n2014-02-10 05:36:44:185 # Auto-install minor updates: Yes (User preference)\r\n2014-02-10 05:36:44:185 # ServiceTypeDefault: Service 117CAB2D-82B1-4B5A-A08C-4D62DBEE7782\r\n                        Approval type: (Scheduled)\r\n2014-02-10 05:36:44:185 # Will interact with non-admins (Non-admins are elevated (User preference))\r\n2014-02-10 05:36:44:204 WARNING: Failed to get Wu Exemption info from NLM, assuming not exempt,\r\n                        error = 0x80070490\r\n2014-02-10 05:36:44:213 AU finished delayed initialization\r\n2014-02-10 05:38:01:000 #############\r\n...\r\n\r\nIn this example, the WindowsUpdate log is converted from text to objects using\r\nthe regular expression pattern. Given the size of the log file this process \r\ncan take some time to complete. For example, an 11,000+ line file took 20 minutes.\r\n\r\n.EXAMPLE\r\nPC C:\\&gt; get-content c:\\windows\\windowsupdate.log -totalcount 50 | ConvertFrom-Text $wu\r\n\r\nThis example gets the first 50 lines from the Windows update log and converts \r\nthat to objects using the pattern from the previous example.\r\n.EXAMPLE\r\nPS C:\\&gt; $c = \"(?&lt;Protocol&gt;\\w{3})\\s+(?&lt;LocalIP&gt;(\\d{1,3}\\.){3}\\d{1,3}):(?&lt;LocalPort&gt;\\d+)\\s+(?&lt;ForeignIP&gt;.*):(?&lt;ForeignPort&gt;\\d+)\\s+(?&lt;State&gt;\\w+)?\"\r\nPS C:\\&gt; netstat | select -skip 4 | convertfrom-text $c | format-table\r\n\r\nProtocol LocalIP      LocalPort ForeignIP      ForeignPort State      \r\n-------- -------      --------- ---------      ----------- -----      \r\nTCP      127.0.0.1    19872     Novo8          50835       ESTABLISHED\r\nTCP      127.0.0.1    50440     Novo8          50441       ESTABLISHED\r\nTCP      127.0.0.1    50441     Novo8          50440       ESTABLISHED\r\nTCP      127.0.0.1    50445     Novo8          50446       ESTABLISHED\r\nTCP      127.0.0.1    50446     Novo8          50445       ESTABLISHED\r\nTCP      127.0.0.1    50835     Novo8          19872       ESTABLISHED\r\nTCP      192.168.6.98 50753     74.125.129.125 5222        ESTABLISHED\r\n\r\nThe first command creates a variable to be used with output from the Netstat\r\ncommand which is used in the second command.\r\n.EXAMPLE\r\nPS C:\\&gt; $arp = \"(?&lt;IPAddress&gt;(\\d{1,3}\\.){3}\\d{1,3})\\s+(?&lt;MAC&gt;(\\w{2}-){5}\\w{2})\\s+(?&lt;Type&gt;\\w+$)\"\r\nPS C:\\&gt; arp -g | select -skip 3 | foreach {$_.Trim()} | convertfrom-text $arp\r\n\r\nIPAddress                         MAC                              Type\r\n---------                         ---                              ----\r\n172.16.10.1                       00-13-d3-66-50-4b                dynamic\r\n172.16.10.100                     00-0d-a2-01-07-5d                dynamic\r\n172.16.10.101                     2c-76-8a-3d-11-30                dynamic\r\n172.16.10.121                     00-0e-58-ce-8b-b6                dynamic\r\n172.16.10.122                     1c-ab-a7-99-9a-e4                dynamic\r\n172.16.10.124                     00-1e-2a-d9-cd-b6                dynamic\r\n172.16.10.126                     00-0e-58-8c-13-ac                dynamic\r\n172.16.10.128                     70-11-24-51-84-60                dynamic\r\n...\r\n\r\nThe first command creates a regular expression for the ARP command. The second\r\nprompt shows the ARP command being used to select the content, trimming each \r\nline, and then converting the output to text using the regular expression named\r\npattern.\r\n.NOTES\r\nLast Updated: February 10, 2014\r\nVersion     : 0.9\r\n\r\nLearn more:\r\n PowerShell in Depth: An Administrator's Guide (http:\/\/www.manning.com\/jones2\/)\r\n PowerShell Deep Dives (http:\/\/manning.com\/hicks\/)\r\n Learn PowerShell 3 in a Month of Lunches (http:\/\/manning.com\/jones3\/)\r\n Learn PowerShell Toolmaking in a Month of Lunches (http:\/\/manning.com\/jones4\/)\r\n\r\n  ****************************************************************\r\n  * DO NOT USE IN A PRODUCTION ENVIRONMENT UNTIL YOU HAVE TESTED *\r\n  * THOROUGHLY IN A LAB ENVIRONMENT. USE AT YOUR OWN RISK.  IF   *\r\n  * YOU DO NOT UNDERSTAND WHAT THIS SCRIPT DOES OR HOW IT WORKS, *\r\n  * DO NOT USE IT OUTSIDE OF A SECURE, TEST SETTING.             *\r\n  ****************************************************************\r\n.LINK\r\nhttp:\/\/jdhitsolutions.com\/blog\/2014\/02\/convert-text-to-object-with-powershell-and-regular-expressions\r\n.LINK\r\nGet-Content\r\nAbout_Regular_Expressions\r\n#&gt;\r\n\r\n[cmdletbinding(DefaultParameterSetname=\"File\")]\r\nParam(\r\n\r\n[Parameter(Position=0,Mandatory,\r\nHelpMessage=\"Enter a regular expression pattern that uses named captures\")]\r\n[ValidateScript({\r\n  if (($_.GetGroupNames() | where {$_ -notmatch \"^\\d{1}$\"}).Count -ge 1) {\r\n    $True\r\n  }\r\n  else {\r\n    Throw \"No group names found in your regular expression pattern.\"\r\n  }\r\n})]\r\n[Alias(\"regex\")]\r\n[regex]$Pattern,\r\n[Parameter(Position=1,Mandatory,ParameterSetName='File')]\r\n[ValidateScript({Test-Path $_})]\r\n[string]$Path,\r\n\r\n[Parameter(Position=1,Mandatory,ValueFromPipeline,ParameterSetName='Inputobject')]\r\n[ValidateNotNullorEmpty()]\r\n[string]$InputObject\r\n\r\n)\r\n\r\nBegin {\r\n    $begin=Get-Date\r\n    Write-Verbose \"$((Get-Date).TimeOfDay) Starting $($MyInvocation.Mycommand)\"  \r\n    Write-verbose \"$((Get-Date).TimeOfDay) Parameter set $($PSCmdlet.ParameterSetName)\"\r\n    Write-Verbose \"$((Get-Date).TimeOfDay) Using pattern $($pattern.ToString())\"\r\n    #Get the defined capture names    \r\n    $names = $pattern.GetGroupNames() | where {$_ -notmatch \"^\\d+$\"}\r\n    Write-Verbose \"$((Get-Date).TimeOfDay) Using names: $($names -join ',')\"\r\n\r\n    #define a hashtable of parameters to splat with Write-Progress\r\n    $progParam=@{\r\n      Activity=$myinvocation.mycommand\r\n      Status = \"pre-processing\"\r\n    }\r\n} #begin\r\n\r\nProcess {\r\n  If ($PSCmdlet.ParameterSetName -eq 'File') {\r\n    Write-Verbose \"$((Get-Date).TimeOfDay) Processing $Path\"\r\n    Try {\r\n        $progParam.CurrentOperation=\"Getting content from $path\"\r\n        $progParam.Status=\"Processing\"\r\n        Write-Progress @progParam\r\n        $content = Get-Content -path $path | where {$_}\r\n    } #try\r\n    Catch {\r\n        Write-Warning \"Could not get content from $path. $($_.Exception.Message)\"\r\n        Write-Verbose \"$((Get-Date).TimeOfDay) Exiting function\"\r\n\r\n        Return\r\n    }\r\n    } #if file parameter set\r\n    else {\r\n        Write-Verbose \"$((Get-Date).TimeOfDay) processing input: $Inputobject\"\r\n        $content = $InputObject\r\n    }\r\n\r\n    if ($content) {\r\n        Write-Verbose \"$((Get-Date).TimeOfDay) processing content\"\r\n        $content |  foreach-object -begin {$i=0} -process {\r\n         #calculate percent complete\r\n         $i++\r\n         $pct=($i\/$content.count)*100\r\n         $progParam.PercentComplete=$pct\r\n         $progParam.Status=\"Processing matches\"\r\n         Write-Progress @progParam\r\n         #process each line of the text file\r\n         $pattern.Matches($_) | \r\n         foreach-object {\r\n            #process each match\r\n            $match = $_\r\n            Write-Verbose \"$((Get-Date).TimeOfDay) processing match\"\r\n            $progParam.currentoperation=$match\r\n            Write-Progress @progParam\r\n\r\n            #get named matches and create a hash table for each one\r\n            $progParam.Status = \"Creating objects\"\r\n            Write-Verbose \"$((Get-Date).TimeOfDay) creating objects\"\r\n            $hash=[ordered]@{}\r\n            foreach ($name in $names) {\r\n              $progParam.CurrentOperation=$name\r\n              Write-Progress @progParam\r\n              Write-Verbose \"$((Get-Date).TimeOfDay) getting $name\"\r\n              #initialize an ordered hash table\r\n\r\n              #add each name as a key to the hash table and the corresponding regex value\r\n              $hash.Add($name,$match.groups[\"$name\"].value)\r\n\r\n            }\r\n             Write-Verbose \"$((Get-Date).TimeOfDay) writing object to pipeline\"\r\n              #write a custom object to the pipeline\r\n              [pscustomobject]$hash\r\n\r\n         } #foreach match\r\n        } #foreach line in the content\r\n    } #if $content\r\n} #process\r\n\r\nEnd {\r\n    Write-Verbose \"$((Get-Date).TimeOfDay) Ending $($MyInvocation.Mycommand)\"\r\n    $end = Get-Date\r\n    Write-Verbose \"$((Get-Date).TimeOfDay) Total processing time $($end-$begin)\"\r\n} #end\r\n\r\n} #end function\r\n\r\n#define an optional alias\r\nSet-Alias -Name cft -Value ConvertFrom-Text<\/pre>\n<p>The function requires a regular expression pattern that uses named captures. With the pattern you can either specify the path to a log file, or you can pipe structured text to the function. By \"structured text\" I mean something like a log file with a predictable pattern. Or even output from a command line tool that has a consistent layout. The important part is that you can come up with a regular expression pattern to analyze the data. I also wanted to be able to pipe in text in the event I only wanted to process part of a large log file.<\/p>\n<p>Here's an example using the ARP command.<\/p>\n<pre class=\"lang:batch decode:true\">PS C:\\&gt; $arp = \"(?&lt;IPAddress&gt;(\\d{1,3}\\.){3}\\d{1,3})\\s+(?&lt;MAC&gt;(\\w{2}-){5}\\w{2})\\s+(?&lt;Type&gt;\\w+$)\"\r\nPS C:\\&gt; arp -g | select -skip 3 | foreach {$_.Trim()} | convertfrom-text $arp<\/pre>\n<p>In this particular example, I'm trimming the ARP output to remove any leading or trailing spaces from each line and then converting each line to an object, using the regular expression pattern.<\/p>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/02\/convertfrom-text.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-3676\" alt=\"convertfrom-text\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/02\/convertfrom-text-300x216.png\" width=\"300\" height=\"216\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/02\/convertfrom-text-300x216.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/02\/convertfrom-text.png 837w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>If you haven't jumped to why command is useful, is that once I have objects I can easily filter, sort, group, export, or just about anything else. By converting a log file into a collection of objects I can do tasks like this:<\/p>\n<pre class=\"lang:ps decode:true\">$wu = \"(?&lt;Date&gt;\\d{4}-\\d{2}-\\d{2})\\s+(?&lt;Time&gt;(\\d{2}:)+\\d{3})\\s+(?&lt;PID&gt;\\d+)\\s+(?&lt;TID&gt;\\w+)\\s+(?&lt;Component&gt;\\w+)\\s+(?&lt;Message&gt;.*)\"\r\n$out = get-content c:\\windows\\windowsupdate.log -totalcount 50 | ConvertFrom-Text $wu\r\n$out | group Component  | sort count\r\n$ht = $out | group Component  -AsHashTable\r\n$ht.agent\r\n<\/pre>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/02\/convertfrom-text-2.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/02\/convertfrom-text-2-300x216.png\" alt=\"convertfrom-text-2\" width=\"300\" height=\"216\" class=\"aligncenter size-medium wp-image-3677\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/02\/convertfrom-text-2-300x216.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/02\/convertfrom-text-2.png 837w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>I hope some of you will try this out and let me know what you think. What works? What is missing? What problem did this solve? Inquiring minds, well at least mine, want to know. Enjoy.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A few weeks ago I was getting more familiar with named captures in regular expressions. With a named capture, you can give your matches meaningful names which makes it easier to access specific captures. The capture is done by prefixing your regular expression pattern with a name. PS C:\\&gt; &#8220;UNC is \\\\server01\\public&#8221; -match &#8220;\\\\\\\\(?&lt;servername&gt;\\w+)\\\\(?&lt;sharename&gt;\\w+)&#8221; True&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"Fresh from the blog: Convert Text to Object with #PowerShell and Regular Expressions http:\/\/wp.me\/p1nF6U-Xf","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[72,359,8],"tags":[199,534,268,250,540],"class_list":["post-3673","post","type-post","status-publish","format-standard","hentry","category-commandline","category-powershell-3-0","category-scripting","tag-hashtable","tag-powershell","tag-regex","tag-regular-expressions","tag-scripting"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Convert Text to Object with PowerShell and Regular Expressions &#8226; The Lonely Administrator<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jdhitsolutions.com\/blog\/scripting\/3673\/convert-text-to-object-with-powershell-and-regular-expressions\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Convert Text to Object with PowerShell and Regular Expressions &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"A few weeks ago I was getting more familiar with named captures in regular expressions. With a named capture, you can give your matches meaningful names which makes it easier to access specific captures. The capture is done by prefixing your regular expression pattern with a name. PS C:&gt; &quot;UNC is \\server01public&quot; -match &quot;\\\\(?&lt;servername&gt;w+)\\(?&lt;sharename&gt;w+)&quot; True...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/scripting\/3673\/convert-text-to-object-with-powershell-and-regular-expressions\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2014-02-10T17:24:40+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/squarepattern-150x150.png\" \/>\n<meta name=\"author\" content=\"Jeffery Hicks\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:site\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeffery Hicks\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3673\\\/convert-text-to-object-with-powershell-and-regular-expressions\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3673\\\/convert-text-to-object-with-powershell-and-regular-expressions\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Convert Text to Object with PowerShell and Regular Expressions\",\"datePublished\":\"2014-02-10T17:24:40+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3673\\\/convert-text-to-object-with-powershell-and-regular-expressions\\\/\"},\"wordCount\":392,\"commentCount\":4,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3673\\\/convert-text-to-object-with-powershell-and-regular-expressions\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2012\\\/04\\\/squarepattern-150x150.png\",\"keywords\":[\"hashtable\",\"PowerShell\",\"regex\",\"Regular Expressions\",\"Scripting\"],\"articleSection\":[\"CommandLine\",\"Powershell 3.0\",\"Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3673\\\/convert-text-to-object-with-powershell-and-regular-expressions\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3673\\\/convert-text-to-object-with-powershell-and-regular-expressions\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3673\\\/convert-text-to-object-with-powershell-and-regular-expressions\\\/\",\"name\":\"Convert Text to Object with PowerShell and Regular Expressions &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3673\\\/convert-text-to-object-with-powershell-and-regular-expressions\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3673\\\/convert-text-to-object-with-powershell-and-regular-expressions\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2012\\\/04\\\/squarepattern-150x150.png\",\"datePublished\":\"2014-02-10T17:24:40+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3673\\\/convert-text-to-object-with-powershell-and-regular-expressions\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3673\\\/convert-text-to-object-with-powershell-and-regular-expressions\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3673\\\/convert-text-to-object-with-powershell-and-regular-expressions\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2012\\\/04\\\/squarepattern.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2012\\\/04\\\/squarepattern.png\",\"width\":\"1280\",\"height\":\"853\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3673\\\/convert-text-to-object-with-powershell-and-regular-expressions\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"CommandLine\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/commandline\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Convert Text to Object with PowerShell and Regular Expressions\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/\",\"name\":\"The Lonely Administrator\",\"description\":\"Practical Advice for the Automating IT Pro\",\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\",\"name\":\"Jeffery Hicks\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"caption\":\"Jeffery Hicks\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Convert Text to Object with PowerShell and Regular Expressions &#8226; The Lonely Administrator","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3673\/convert-text-to-object-with-powershell-and-regular-expressions\/","og_locale":"en_US","og_type":"article","og_title":"Convert Text to Object with PowerShell and Regular Expressions &#8226; The Lonely Administrator","og_description":"A few weeks ago I was getting more familiar with named captures in regular expressions. With a named capture, you can give your matches meaningful names which makes it easier to access specific captures. The capture is done by prefixing your regular expression pattern with a name. PS C:&gt; \"UNC is \\server01public\" -match \"\\\\(?&lt;servername&gt;w+)\\(?&lt;sharename&gt;w+)\" True...","og_url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3673\/convert-text-to-object-with-powershell-and-regular-expressions\/","og_site_name":"The Lonely Administrator","article_published_time":"2014-02-10T17:24:40+00:00","og_image":[{"url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/squarepattern-150x150.png","type":"","width":"","height":""}],"author":"Jeffery Hicks","twitter_card":"summary_large_image","twitter_creator":"@JeffHicks","twitter_site":"@JeffHicks","twitter_misc":{"Written by":"Jeffery Hicks","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3673\/convert-text-to-object-with-powershell-and-regular-expressions\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3673\/convert-text-to-object-with-powershell-and-regular-expressions\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Convert Text to Object with PowerShell and Regular Expressions","datePublished":"2014-02-10T17:24:40+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3673\/convert-text-to-object-with-powershell-and-regular-expressions\/"},"wordCount":392,"commentCount":4,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3673\/convert-text-to-object-with-powershell-and-regular-expressions\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/squarepattern-150x150.png","keywords":["hashtable","PowerShell","regex","Regular Expressions","Scripting"],"articleSection":["CommandLine","Powershell 3.0","Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/scripting\/3673\/convert-text-to-object-with-powershell-and-regular-expressions\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3673\/convert-text-to-object-with-powershell-and-regular-expressions\/","url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3673\/convert-text-to-object-with-powershell-and-regular-expressions\/","name":"Convert Text to Object with PowerShell and Regular Expressions &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3673\/convert-text-to-object-with-powershell-and-regular-expressions\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3673\/convert-text-to-object-with-powershell-and-regular-expressions\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/squarepattern-150x150.png","datePublished":"2014-02-10T17:24:40+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3673\/convert-text-to-object-with-powershell-and-regular-expressions\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/scripting\/3673\/convert-text-to-object-with-powershell-and-regular-expressions\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3673\/convert-text-to-object-with-powershell-and-regular-expressions\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/squarepattern.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/squarepattern.png","width":"1280","height":"853"},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3673\/convert-text-to-object-with-powershell-and-regular-expressions\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"CommandLine","item":"https:\/\/jdhitsolutions.com\/blog\/category\/commandline\/"},{"@type":"ListItem","position":2,"name":"Convert Text to Object with PowerShell and Regular Expressions"}]},{"@type":"WebSite","@id":"https:\/\/jdhitsolutions.com\/blog\/#website","url":"https:\/\/jdhitsolutions.com\/blog\/","name":"The Lonely Administrator","description":"Practical Advice for the Automating IT Pro","publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jdhitsolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9","name":"Jeffery Hicks","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","caption":"Jeffery Hicks"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg"}}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":6791,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6791\/capturing-names-with-powershell-and-regular-expressions\/","url_meta":{"origin":3673,"position":0},"title":"Capturing Names with PowerShell and Regular Expressions","author":"Jeffery Hicks","date":"July 3, 2019","format":false,"excerpt":"As you continue to learn and embrace PowerShell, you will eventually meet regular expressions. Hopefully many of you already have some fundamental knowledge. if not, the first place to start is by reading the help topic, about_regular_expressions In this article, I'm gong to introduce you to an advanced regular expression\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/07\/regex-match-9_thumb.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/07\/regex-match-9_thumb.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/07\/regex-match-9_thumb.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":3105,"url":"https:\/\/jdhitsolutions.com\/blog\/wmi\/3105\/adding-system-path-to-ciminstance-objects\/","url_meta":{"origin":3673,"position":1},"title":"Adding System Path to CIMInstance Objects","author":"Jeffery Hicks","date":"June 13, 2013","format":false,"excerpt":"The other night when I presented for the Mississippi PowerShell Users' Group, one of the members showed some PowerShell 3.0 code using the CIM cmdlets. At issue is how the CIM cmdlets handle the WMI system properties like __SERVER and __RELPATH. By default, those properties aren't displayed, but they are\u2026","rel":"","context":"In &quot;Powershell 3.0&quot;","block_context":{"text":"Powershell 3.0","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-3-0\/"},"img":{"alt_text":"gcim-systemproperties","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/06\/gcim-systemproperties-1024x362.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/06\/gcim-systemproperties-1024x362.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/06\/gcim-systemproperties-1024x362.png?resize=525%2C300 1.5x"},"classes":[]},{"id":3789,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3789\/set-local-user-account-with-powershell\/","url_meta":{"origin":3673,"position":2},"title":"Set Local User Account with PowerShell","author":"Jeffery Hicks","date":"April 15, 2014","format":false,"excerpt":"The other day I received an email from a student asking for some help in using PowerShell to take care of a user account on a local computer. He not only wanted to be able to set the password, which he had already figured out, but also how to enable\u2026","rel":"","context":"In &quot;CommandLine&quot;","block_context":{"text":"CommandLine","link":"https:\/\/jdhitsolutions.com\/blog\/category\/commandline\/"},"img":{"alt_text":"halfuser","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/04\/halfuser-190x300.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":826,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/826\/friday-the-13-script-blocks\/","url_meta":{"origin":3673,"position":3},"title":"Friday the 13 Script Blocks","author":"Jeffery Hicks","date":"August 13, 2010","format":false,"excerpt":"In celebration of Friday the 13th and to help ward off any triskaidekaphobia I thought I'd offer up 13 PowerShell scriptblocks. These are scriptblocks that might solve a legitimate business need like finding how long a server has been running to the more mercurial such as how many hours before\u2026","rel":"","context":"In &quot;PowerShell v2.0&quot;","block_context":{"text":"PowerShell v2.0","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-v2-0\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1095,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1095\/powershell-regular-expressions-by-the-numbers\/","url_meta":{"origin":3673,"position":4},"title":"PowerShell Regular Expressions by the Numbers","author":"Jeffery Hicks","date":"February 3, 2011","format":false,"excerpt":"I've been working on something the last week that brought me back into sometimes frightening world of regular expressions. But as the saying goes, we only fear what we don't understand. So a little knowledge can be a wonderful thing. In this particular situation I was looking for a regular\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":7848,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7848\/parsing-ssh-known-hosts-with-powershell-and-regular-expressions\/","url_meta":{"origin":3673,"position":5},"title":"Parsing ssh Known Hosts with PowerShell and Regular Expressions","author":"Jeffery Hicks","date":"November 9, 2020","format":false,"excerpt":"Lately, I've been spending time learning more about ssh. Sadly, I've rarely had a need to learn and use ssh. But of course, with PowerShell 7 and ssh-based remoting, it is time to up my game. I've started deploying the ssh server component to my Windows test servers (I'll write\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/get-knownhost-3.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/get-knownhost-3.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/get-knownhost-3.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/get-knownhost-3.png?resize=700%2C400&ssl=1 2x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/3673","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=3673"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/3673\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=3673"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=3673"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=3673"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}