All Questions
17 questions
0
votes
0
answers
85
views
Negative lookahead not working as intended
I would like to create a regex, that matches along the following criteria and I am using the Select-String function of PowerShell. I have this query,and I want to get all parameter variations(so the ...
0
votes
1
answer
145
views
regex lookbehind is `>` a shortcut for `<=`?
Through some convoluted testing, I ended up potentially discovering a shortcut.
A lookbehind in PowerShell is supposed to use the <= syntax, which is referenced in various other places when ...
1
vote
1
answer
370
views
How to match, but not capture, part of a regex with Powershell
I have a line in a text doc that im trying to pull data from.
Example
Line im searching for in Text file:
Valid from: Sun May 17 19:00:00 CDT 1998
I want to find the key words "Valid from:"...
1
vote
1
answer
71
views
Regular Expression misses matches in string
I'm trying to write a regular expression that captures desired strings between strings
("f38 ","f38 ","f1 ", "..") and ("\par","\hich",&...
0
votes
2
answers
3k
views
Select-string regex
I'm searching a ton of logs using a foreach loop for a string ($text) and currently outputting the entire line to an output file ($logfile)
Get-ChildItem "\\$server\$Path" -Filter "*....
0
votes
3
answers
98
views
Easiest way to REGEX Capture eveything except what you specify?
I for the life of me cannot figure out how to negate everything but what I want to capture with REGEX.
I get close with [^(\d{4}-\d{3}-\d{3}]
But doing a replace in powershell with an input of:
1234-...
0
votes
1
answer
742
views
Regex using negative lookahead missing first character of group2
I need to get the LDAP group names from this example string:
"user.ldap.groups.name" = "M-Role13" AND ("user.ldap.groups.name"= "M Role1" OR "user.ldap.groups.name" = "M.Group-Role16" OR "user.ldap....
2
votes
2
answers
5k
views
RegEx for not matching a sequence in PowerShell
I want to validate a string and the regex should not match when a dot "." has a "-" or "_" directly before or after it.
I assume a negative lookahead would be the best approach but I can't seem to ...
1
vote
3
answers
953
views
RegEx for matching specific words and ignoring new lines
Full Text =
"
......
A=
B= 12345
....."
I want to get empty word "" between A= and line break.
and want to get "12345" between B= and line break.
How can I get words using regular expression?
(?&...
4
votes
3
answers
3k
views
Select-String: match a string only if it isn't preceded by a specific character
I have a list of files that contain either of the two strings:
"stuff" or ";stuff"
I'm trying to write a PowerShell Script that will return only the files that contain "stuff". The script below ...
2
votes
1
answer
51
views
Regex lookahead part of group accepted
I'm using regex in powershell 5.1.
I need it to detect groups of numbers, but ignore groups followed or preceeded by /, so from this it should detect only 9876.
[regex]::matches('9876 1234/56',‘(?&...
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 ...
2
votes
1
answer
422
views
Regex - Match a single instance/occurrence of a character per line
I really am not getting how I can match just a single instance of both a whitespace or a dash. I am able to get some results but still unable to get the desired one. I have actually tried different ...
0
votes
4
answers
850
views
regex lookbehind
I have a problem with regex lookbehind!
here is my sample text:
href="dermatitis>" "blah blah blah >" href="lichen-planus>"
I want to match all >" if and only if there ...
1
vote
1
answer
82
views
PowerShell Issues with getting string from file
Problem
I am working on an automated version control script in powershell and I hit a snag where I am trying pull a line of text from an AssemblyInfo.cs file. However, I can't seem to get it to work ...