PowerShell Regex Examples

https://regex101.com/ handy website to check your regex results

Regular Expression Language – Quick Reference

Simple comparison to find a part of a line that matches “.*.enc” where the * is 3 characters or more and  each character is a-z or A-Z

the \ is used to escape the .

($LineToCheck -match "\.[a-zA-Z]{3,}\.enc") 

e.g.

.docx.enc

.doc.enc

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.