Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. "-----start-------Hello World------end-------"
  2.  
  3. Hello World
  4.  
  5. PS C:> $x = "----start----Hello World----end----"
  6. PS C:> $x -match "----start----(?<content>.*)----end----"
  7. True
  8. PS C:> $matches['content']
  9. Hello World
  10.  
  11. PS > "test_string".Substring(0,4)
  12. Test
  13. PS > "test_string".Substring(4)
  14. _stringPS >
  15.  
  16. $s = 'Hello World is in here Hello World!'
  17. $p = 'Hello World'
  18. $s -match $p
  19.  
  20. dir -rec -filter *.txt | Select-String 'Hello World'
  21.  
  22. $String="----start----`nHello World`n----end----"
  23. $SearchStart="----start----`n" #Will not be included in results
  24. $SearchEnd="`n----end----" #Will not be included in results
  25. $String -match "(?s)$SearchStart(?<content>.*)$SearchEnd"
  26. $result=$matches['content']
  27. $result
  28.  
  29. $String=[string]::join("`n", (Get-Content $Filename))
  30.  
  31. $line = "----start----Hello World----end----"
  32. $line -match "Hello World"
  33. $matches[0]
  34. Hello World
  35.  
  36. $result = $matches[0]
  37. $result
  38. Hello World
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement