Skip to main content
How are we doing? Please help us improve Stack Overflow. Take our short survey

All Questions

1 vote
2 answers
161 views

Remove all label tags inside a string

I want to remove all label tags from a string. This is the input string. <p> <title>Contact Us</title> </p> <table dropzone="copy"> <tbody> &...
Owais Ahmed's user avatar
  • 1,438
1 vote
1 answer
115 views

Get data between two tags

I need to extract text between two tags <mail> and </mail> This is the text <?xml version='1.0' encoding='utf-16'?> <li xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='...
Owais Ahmed's user avatar
  • 1,438
-1 votes
1 answer
62 views

unable to parse regex pattern form file to the variable in powershell

I am looking for whether the folder name is as per the below regex pattern in powershell. Check first 4 letters are HOST. Check next 3 or 4 letters as per the shortnames in the c:\shortnameslist.csv. ...
DevopsDevelop's user avatar
-1 votes
1 answer
34 views

How to include one line above of the keyword line during SPLITING a big txt file using Regex and PowerShell

We have got a big txt file ("C:\temp\longmessages.txt") like below: Americas This is Start some text 1 some text 2 some text 3 etc. etc End Europe This is Start some text 4 some text 5 some ...
M-A Charlotte's user avatar
0 votes
1 answer
517 views

Rename all txt files in a folder based on file content

Can someone please help to use PowerShell to rename individual txt files in a folder, each file needs to be renamed based on a keyword inside each individual txt file. e.g. c:\temp\1.txt may have a ...
M-A Charlotte's user avatar
0 votes
4 answers
86 views

Get text between two characters

I have a plain text file like below: "[email protected]" "[email protected]" "[email protected]" and so on... Now using Powershell I am trying to read line by line this plain text ...
Willy's user avatar
  • 10.7k
0 votes
3 answers
35 views

Loop through a text file and Extract a set of 100 IP's from a text file and output to separate text files

I have a text file that contains around 900 IP's. I need to create batch of 100 IP's from that file and output them into new files. That would create around 9 text files. Our API only allows to POST ...
Analyst's user avatar
3 votes
4 answers
1k views

Regular Expressions in powershell split

I need to strip out a UNC fqdn name down to just the name or IP depending on the input. My examples would be \\tom.overflow.corp.com \\123.43.234.23.overflow.corp.com I want to end up with just ...
jim wood's user avatar
-2 votes
2 answers
1k views

replace numbers - powershell

Trying to create a script which organizes each filename into: Year, Month & Day variables. To do this in PowerShell with my current version I need to use -replace however it will only remove ...
Dino the Dinosaur's user avatar
0 votes
0 answers
467 views

How to extract a date (yyyy-dd-mm hh:mm:ss) from a string using powershell [duplicate]

I am a new bee to powershell, stuck with extracting the date from the below string "C:\Program Files\PostgreSQL\data\logs\pg10\postgresql-Sun.log:12:2018-04-08 23:34:08 UTC [4052]: [1-1] user=testdb,...
Arjun balan's user avatar
1 vote
2 answers
666 views

powershell regex issue with powershell 2 vs. powershell 5 end of line anchor

Given the following code: $inputString = "`r`n#cmakedefine BREAK_THE_CODE`r`n" $match = '(?m)^(.*?)#cmakedefine(.*?)$' $replace = 'hello $1#undef$2 goodbye ' $retVal = $inputString -replace $match,$...
zzxyz's user avatar
  • 2,991
1 vote
1 answer
119 views

Change file names with powershell DMY -> YMD

I have to change alot of files on a Windows computer and I will be using Powershell to do it. The file names are like name_name_DDMMYYYY_XXXXXX.bmp John_Doe_03062009_123456.bmp ...
Ron's user avatar
  • 30
0 votes
0 answers
125 views

Matching until you reach a string using Powershell 2.0

I'm trying to write a Regex that searches the source code of a series of webpages in a CSV file. I'm using the following to do the match: $linkContent = $web.DownloadString($linkToBeConverted) $...
Oaryx's user avatar
  • 77
1 vote
1 answer
76 views

Comparing installed and current versions

I want to get installed versions and current versions from a log file and I have got the output by using the following commands: $versions = Select-String -Path $path -Pattern "Comparing product ...
Sumith Chalil's user avatar
0 votes
3 answers
6k views

Filter the strings which startswith (one or two) slashes in PowerShell

I'm trying to find out the strings which starts with one slash(/) and two slashes(//). For example, following is the array which have few strings: Following is the code I'm trying: $array = @("/...
mahesh's user avatar
  • 478

15 30 50 per page