$re = '/^((\.{2}\\\\)+|(\.?\\\\)?).+[^:\r\n]$/m';
$str = 'Directories:
\\\\Reports\\Test\\\\Test
..\\meeting_minutes
..\\..\\profile
Reports\\2023\\summary
\\Reports\\2023\\summary
.\\Reports\\2023\\summary
..\\Projects\\project_a
..\\Projects\\project a
..\\Projects\\..\\.\\project\\.\\..\\a
.\\my_file
..\\Music#a\\file
..\\Music[Genre]\\file
..\\Music(Genre)\\file
..\\Music-Hardcore-Metal\\file
..\\Documents\\My+File
..\\Documents\\Some{Document}
..\\Files\\Afilewithweird;Characters\'`
..\\Music#^@!()-+{};\',.`~a\\file
.
..\\
..\\..
..\\..\\
\\\\Reports\\Test\\\\Test
..\\..\\Final
.\\..\\Test
.\\..\\Test\\
..\\..\\.\\Final\\..\\Shapefiles\\.\\Landuse
..\\..\\.\\Final\\..\\Shapefiles\\.\\Landuse\\
..\\..\\data
./data-files/geological/EQs_last_week_of_2021.csv../data-files/geological/
EQs_last_week_of_2021.csv../../data-files/EQs_last_week_of_2021.csv../../../data-files/
media\\🎵 music\\lo-fi & chill\\set_03 (remastered)
..\\..\\data\\[raw]_input_🧪\\test-sample(01)
src\\core.modules\\engine@v4
docs\\2025_06\\📝meeting_notes (draft)\\summary
docs\\2025_06\\📝meeting_notes (draft)\\summary\\
Files\\
Files
EQs_last_week_of_2021.csv../../../data-files/geological/EQs_last_week_of_2021
../pictures/file
.\\temp\\[backup]_2024\\final-version (2)
assets\\images\\new.logo-2025_v2\\icon@2x#1
..\\users\\username\\Documents (Archived)\\plan[final]
projects\\#active-clients\\ACME_Corp\\Q2 Report\\summary v1.3\\
config\\env-settings\\!urgent
media\\🎵 music\\lo-fi & chill\\set_03 (remastered)
..\\..\\data\\[raw]_input_🧪\\test-sample(01)
src\\core.modules\\engine@v4
docs\\2025_06\\meeting_notes (draft)\\📝summary_notes
themes\\🌑 darkmode (beta)\\style-final!
..\\..\\logs\\🪵 log-archive\\2023-12-25Christmas
..\\..\\logs\\🪵 log-archive\\2023-12-25[Christmas]
..\\..\\logs\\🪵 log-archive\\2023-12-25 [Christmas]
downloads\\zips\\patch_update v34-final!
build\\#output$\\v2.1.1\\installer(64bit)
components\\UI-Toolkit_🔥\\modaldialog
scripts\\batch jobs\\cleanup-temp_files!
resources\\📁 static\\fonts\\Roboto_Bold-Italic
tests\\[integration]_suite#2\\test-case(01)
temp\\$$merge_conflict\\attempt_#3\\resolved✅
locales\\en-US\\messages(v1
backup\\[legacy]_configs\\1999
src\\modules\\@internal\\storage-handler
..\\releases\\build#2025.06.14\\installer-vFinal
app\\#dev[tools]\\init
Files:
..\\users\\username\\Documents (Archived)\\plan[final]\\theplan.txt
projects\\#active-clients\\ACME_Corp\\Q2 Report\\summary v1.3\\summary.txt
config\\env-settings\\!urgent\\OVERVIEW.XLSX
media\\🎵 music\\lo-fi & chill\\set_03 (remastered)\\Cool Song.mp3
..\\..\\data\\[raw]_input_🧪\\test-sample(01)\\Sample.db
src\\core.modules\\engine@v4\\engine.exe
docs\\2025_06\\meeting_notes (draft)\\📝summary_notes.txt
themes\\🌑 darkmode (beta)\\style-final!.update
build\\#output$\\v2.1.1\\installer(64bit)\\install_x64.msi
resources\\📁 static\\fonts\\Roboto_Bold-Italic.ttf
';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php