Extract text between two underscores

Welcome Forums General PowerShell Q&A Extract text between two underscores

Viewing 0 reply threads
  • Author
    Posts
    • #201633
      Participant
      Topics: 2
      Replies: 3
      Points: -1
      Rank: Member
      I need to rename a large number of PDF files that are in the following format:

      _TEXT[1…n]_NAME[1…n]_SUFFIX[1…n]

      Is there a way to extract TEXT [1,2…n] (amount of characters is different for every file) between two underscores using Powershell?

      Is there a way to extract SUFFIX [1,2,..n] after underscore (amount of characters is different for every file)?

      I have tried Dir|Rename-Item {$._name -replace “…””}. That only worked for one part of the project.

Viewing 0 reply threads
  • You must be logged in to reply to this topic.