Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6139457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:59:32+00:00 2026-05-23T17:59:32+00:00

I have created a Powershell routine for setting mp3 tags on songs, where I’d

  • 0

I have created a Powershell routine for setting mp3 tags on songs, where I’d like some of my parameters to act as either a regular expession or a “simple” string. To be specific, if the parameter can be said to work as a regular expression, the function should try to use this for retrieving its value; if it can’t, it should simply use that value.

I’ve just browsed Parameter sets, and don’t think this would suit me since I want to be flexible with the parameter handling; i.e. I’d like several parameters to act this way independently. But maybe I’m wrong in this? Anyway, help would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:59:33+00:00Added an answer on May 23, 2026 at 5:59 pm

    You don’t really need the try/catch if you use:

     IF ($string -as [regex])
    

    If the cast is successful it will return the regex, if not it will return $null, so used as a boolean test in the IF, it will be $true if it is a valid regex, and $false if it is not.

    That being said, the I’d agree with Joey that you should settle on a single match type (either wildcard or regex) and stick with that. There’s too much potential for unintended consequences in trying to determine if a regex metacharacter was intended to be match literally or not.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created some custom PowerShell Cmdlets in C# and would like to provide
I have created a few small flash widgets that stream .mp3 audio from an
I have created a PowerShell script for copying files to a directory, the script,
I have created a gui with powershell that allows me to copy files from
I have a Powershell script where I would like to create a generic List
I have created a Powershell script and set it up to run within a
I have created a couple of PowerShell scripts which configure computers used in a
Does anyone know how to execute a PowerShell script from SSIS? I have created
I have exported data from an EventLog using PowerShell and have created a sample
I have created a powershell module (.psm1) file that includes a few other powershell

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.