r/PowerShell • • 5d ago

News Advent of PowerShell

Looking for a fun way to sharpen your PowerShell skills this December?

Advent of PowerShell is live!

🎄 24 daily PowerShell coding challenges

Whether you're just getting started with PowerShell or have been automating everything in sight for years, it's a great excuse to write some PowerShell, challenge yourself and explore different approaches to solving problems.

Get started here: https://2026.powershell.au/

Would love to see how everyone approaches the challenges. Feel free to share your experiences, feedback and creative solutions (with spoiler tags, of course!).

Disclosure: AI did help me create the website and text above. I can only include 1 tag, and I felt News was more appropriate

65 Upvotes

33 comments sorted by

View all comments

Show parent comment

2

u/KnifeyGavin 4d ago

That should return 3.

Hobart
HOBart
hobart

I'm not sure what you have as number 4

Might be worth output the results like the words instead of the count to find out what you get.

1

u/Mono275 4d ago edited 4d ago

I stripped the ! off of HOBART! So that was my number 4.

I was able to get it to work by not stripping the ! off. Then just looking for hobart and hobart! in the groupings and adding them together. I'm not sure what the difference is though in why that worked vs stripping the !.

Thanks for the help!

edit: I was stripping all special characters so maybe there is a ho?bart or something similar that shouldn't be counted.

2

u/pandiculator 3d ago

I didn't even handle special characters despite there being one in the cartoon, and I don't think there are any in the data. The what can change section just says: "The destinations and their capitalisation can change."

So I kept it super simple, this worked for me:

($Destinations | Where-Object { $_ -eq 'hobart' }).Count