Sha256: 8c7ba6a24989305dd2310643e42a1e438312eaf1aad99f6b17c819adcc51411a

Contents?: true

Size: 313 Bytes

Versions: 524

Compression:

Stored size: 313 Bytes

Contents

function CropText
{
  param($text, $fromPattern, $toPattern)
  
  $from, $to = ([regex]::matches($text, $fromPattern)), ([regex]::matches($text, $toPattern))
  if ($from.count -gt 0 -and $to.count -gt 0) {
    $text.substring($from[0].index, $to[0].index + $to[0].length - $from[0].index)
  } else {
    ""
  }
}

Version data entries

524 entries across 524 versions & 4 rubygems

Version Path
serverspec-0.9.3 lib/serverspec/backend/powershell/support/crop_text.ps1
serverspec-0.9.2 lib/serverspec/backend/powershell/support/crop_text.ps1
serverspec-0.9.1 lib/serverspec/backend/powershell/support/crop_text.ps1
serverspec-0.9.0 lib/serverspec/backend/powershell/support/crop_text.ps1