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

  • Home
  • SEARCH
  • 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 9064899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T16:22:15+00:00 2026-06-16T16:22:15+00:00

Question: What PowerShell regex pattern will return an output like Bash’s string command? I

  • 0

Question: What PowerShell regex pattern will return an output like Bash’s string command?

I found an article on gc and Select-String: Episode #137: Free-base64-ing. http://blog.commandlinekungfu.com/2011/03/episode-137-free-base64-ing.html

I tried a number of regex patterns from a previous question: Regular Expression for alphanumeric and underscores. Regular Expression for alphanumeric and underscores

If I run in Bash: strings –all myfile.bin
Results: 52939 lines of character strings.

gc .\myfile.bin | Select-String -AllMatches “^[a-zA-Z0-9_]*$”
Results: a number of blank lines.

gc .\myfile.bin | Select-String -AllMatches “^\w*$”
Results: 9 lines of characters and a number of blank lines.

gc .\myfile.bin | Select-String -AllMatches “^\w*$”
Results: 9 lines of characters.

gc .\myfile.bin | Select-String -AllMatches “[A-Za-z0-9_]”
Results: Pretty much the entire file, unprintable characters and all.

gc .\myfile.bin | Select-String -AllMatches “^[\p{L} \p{Nd}_]+$”
Results: 20 lines of characters.

So what’s the regex trick that I am missing?

  • 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-06-16T16:22:16+00:00Added an answer on June 16, 2026 at 4:22 pm

    As mentioned, the lack of line breaks will prevent RegEx from working. Microsoft Sysinternals’ strings utility is a good solution.

    If you need a native PowerShell solution, ping me. I wrote a Get-Strings cmdlet in C# that does ASCII (UTF8) and Unicode (UTF16) string extraction from binaries. It is not as fast as Sysinternals, but does have the advantage of putting the output into the PowerShell pipeline.

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

Sidebar

Related Questions

I have a similar, but different, question like How to redirect Powershell output from
In this question Alan posted links to interesting pages about PowerShell. I found also
Newbie question: I would like to run a powershell script (.ps1) at the end
I'm new to powershell and this question will prove that point. I'm trying a
I found a find-and-replace text answer from another question. How do I use PowerShell
This is in response to my previous question: PowerShell: -replace, regex and ($) dollar
To piggyback onto this question, PowerShell script to delete files from list and output
Simple (probably stupid) question. I'm a Powershell novice and am mainly using it to
Question I'd like the CSS background texture for my content area to begin immediately
A powershell question: I want to extract each line in a character stream produced

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.