Jump to content

Regular Expression to Extract File Paths From A String


Recommended Posts

Hello,

If there are any regex experts reading, could I please get to make a regex that will extract valid file paths from a long string full of file paths. The file paths may include spaces.

I am doing a dir of a folder into a variable using the /b switch then I'm trying to extract the file paths, including file names, into an array.

Link to post
Share on other sites

Something like that?

#include <Array.au3>
#include <Constants.au3>
Global $run = Run(@ComSpec & " /c dir /b /a-d ", @SystemDir, @SW_HIDE, $STDOUT_CHILD)
Global $lines
While 1
    $lines &= StdoutRead($run)
    If @error Then ExitLoop
Wend
$aContent = StringSplit(StringStripCR($lines), @LF)
_ArrayDisplay($aContent)

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...