Author Posts

February 15, 2017 at 3:26 pm

I have a string 1234=4578

$S = "1234=4578"

How would I look up only "4578"

Also, where can I learn more about all these special regex conditions? I only know the basics now.

I couldn't find anything in Google.

February 15, 2017 at 3:32 pm

Your example is probably too simplistic, you'd want to define what the possible values could/should be to make a proper regex. You can test them here. I like this one more, but its unreachable for me at the moment.

February 15, 2017 at 3:35 pm

In this case, you wouldn't need to use a regex. You can split the string at the equal sign and select the 2nd item of the array returned by -split.

($S -split '=')[1]

If you want to use a regex the following simple pattern would work.

if ($S -match '=(.*)$') {
    $Matches[1]
}

I hope above helps.

February 15, 2017 at 3:37 pm

I couldn't find anything in Google.

Really? What did you search for?
Regular Expressions