$re = '/^((\.{2}\\\\)+|(\.?\\\\)?).+/m';
$str = '..\\meeting_minutes.txt
..\\..\\profile.txt
Reports\\2023\\summary.txt
\\Reports\\2023\\summary.txt
.\\Reports\\2023\\summary.txt
..\\Projects\\project_a.docx
..\\Projects\\project a.docx
.\\my_file.txt
.\\my file.txt
..\\..\\data
..\\Music#a\\file.mp3
..\\Music[Genre]\\file.mp3
..\\Music(Genre)\\file.mp3
..\\Music-Hardcore-Metal\\file.mp3
..\\Documents\\My+File.xlsx
..\\Documents\\Some{Document}.py
..\\Files\\Afilewithweird;Characters\'`.doc
..\\Music#^@!()-+{};\',.`~a\\file.mp3
..\\..
..\\..\\Final
.
.\\..\\Soils
..\\..\\.\\Final\\..\\Shapefiles\\.\\Landuse
./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/
EQs_last_week_of_2021.csv../../../data-files/geological/EQs_last_week_of_2021.csv
../pictures/file.jpg
.\\temp\\[backup]_2024\\final-version (2).bak
assets\\images\\new.logo-2025_v2\\icon@2x#1.png
..\\users\\Jay Soren\\Documents (Archived)\\plan[final].docx
projects\\#active-clients\\ACME_Corp\\Q2 Report\\summary v1.3.pdf
config\\env-settings\\!urgent.env
media\\🎵 music\\lo-fi & chill\\set_03 (remastered).wav
..\\..\\data\\[raw]_input_🧪\\test-sample(01).csv
src\\core.modules\\engine@v4.2.1.dll
docs\\2025_06\\meeting_notes (draft)\\📝summary_notes.md
themes\\🌑 darkmode (beta)\\style-final!.css
..\\..\\logs\\🪵 log-archive\\2023-12-25 [Christmas].log
downloads\\zips\\patch_update v3.4-final!.zip
build\\#output$\\v2.1.1\\installer(64bit).exe
components\\UI-Toolkit_🔥\\modal.dialog.js
scripts\\batch jobs\\cleanup-temp_files!.bat
resources\\📁 static\\fonts\\Roboto_Bold-Italic.ttf
tests\\[integration]_suite#2\\test-case(01).spec.js
temp\\$$merge_conflict\\attempt_#3\\resolved✅.txt
locales\\en-US\\messages(v1.0.0).json
backup\\[legacy]_configs\\1999.version.ini
src\\modules\\@internal\\storage-handler.ts
..\\releases\\build#2025.06.14\\installer-vFinal.exe
app\\#dev[tools]\\init.env.local
templates\\html\\base.template[mobile] v2.3.html
tools\\@scripts\\🧰_toolbelt\\init+config.ps1
test_data\\unit_tests\\input(1)_#valid.json
uploads\\archive\\⚠️_caution\\delete_me_later!.txt
plugins\\[effects]_pack_v2.0\\shine++.aex
scripts\\build-process\\generate_docs.sh
media\\[video]_exports\\final-cut[HD] 2025-06.mp4
src\\experimental\\feat_XYZ\\🤖 robot_model_v7.py
themes\\🖼️_gallery-view\\art_styles(alt).css
..\\..\\app\\modules@deprecated\\beta_handler_old.py
lib\\_core_\\v5.5.0-preview\\main-module.dll
config\\!config\\alt-🧬variant(2024).cfg
resources\\svg\\📦 package_icons\\box-outline#new.svg
env\\.private\\__secrets__\\[do_not_share].key
db\\migrations\\version_003(rollback).sql
projects\\🔥_hotfix-2025.06.01\\readme[fixed].md
user\\@jay-s\\📂work-in-progress\\demo_v0.1(🛠️).pptx
docs\\[TOC]_index\\ch-02#advanced-topics.md
downloads\\[temp]_🧼cleanup_dir\\file 001.tmp
scripts\\dev\\postinstall_hooks\\hook-runner!.ps1
logs\\📊_analytics\\[monthly]_stats-06-2025.csv
tests\\[🔥stress]_loadtest-v99-final_(PASS).log
source\\hidden\\.config_dir\\!local.env
tasks\\[🧾]_todo_list (critical).txt
patches\\archive\\ver_1.0.0-beta2#RC1.zip
themes\\theme_pack-v9.9\\[ocean🌊]\\index.theme
assets\\icons_special\\svg[✔️].iconset\\✅checked.svg
utils\\run$now\\📈metrics-collector.ts
notes\\[📚]_reference_materials (v3).pdf
';
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