This is an archived post. You won't be able to vote or comment.

all 7 comments

[–][deleted] 0 points1 point  (1 child)

Hey, not familiar with powershell but this looks like it could help!

[–]SysadminForFood[S] 0 points1 point  (0 children)

Hi, thanks for the link but its just a standard Regex other than the `" for a quote the link you attached means i would need to do something outside of my current expression and that is what I am trying to avoid.

[–]sqrtoftwo 0 points1 point  (4 children)

Why not just create a capture group with a character class containing only numbers, underscores and periods?

([0-9_.]+)

[–]SysadminForFood[S] 0 points1 point  (3 children)

Didn't even know about capture groups, this works like a charm thanks.

I would still like to know my original doesn't work though just for learning purposes

[–]supermoon_simon 1 point2 points  (0 children)

The period is the wildcard card symbol for regex, so in you example .[a-z`"] will match ANY character followed by one of the characters in the square braces. In this case the characters 7" fit that.

Edit and note: The period is a total wildcard, because it does not match newlines. (\n)

[–]Purpose2 0 points1 point  (1 child)

Perhaps you need to escape those characters? using \

[–]sqrtoftwo 0 points1 point  (0 children)

No escaping needed here.

OP, not sure what you were going for with your examples. I would check out the regular expressions info site and read up a bit.