• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: PowerShell regex needed to capture a field data

Resolved: PowerShell regex needed to capture a field data

0
By Isaac Tonny on 17/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

The expected outputs should look like below
Thanks

Answer:

Okay, I’m assuming that the data is stored in a variable called $values and is an array where each entry of the array is an individual line, the following should extract your values as requested:

$values | % { [regex]::match( $_ , “(?<=')(.+)(?=')" ) } | Select -ExpandProperty Value [/code]

If $values is just a string containing the data, you can use the following instead:

[regex]::matches($values, “(?<=')(.+)(?=')" ) | Select -ExpandProperty Value [/code]

If you have better answer, please add a comment about this, thank you!

powershell regex regex-negation
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: How do I use SetWindowText with Unicode in Win32 using PowerShell?

01/04/2023

Resolved: Shopware 400 Status Error “This value is too long. It should have 255 character or less.” When I Try Updating Database Table

01/04/2023

Resolved: Using AWK to count multiple patterns in a file

01/04/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.