Regular Expressions 101

Community Patterns

Regex for parsing function command line arguments

0

Regular Expression
PCRE (PHP <7.3)

/
([^" \t\n]+|"[^"]*")
/
g

Description

How i can parse the following function command line: The separtor is (\s-\w\s) like -c or -d or -n C:/my app/bin/Reader.dll -n Proc_20ms -c C:/Users/Braun/Desktop/test.csv -t Continue the simulation from the first line of the csv-file -j none -V errors and warnings (default) -d ,

to:

Match1: C:/my app/bin/Reader.dll Match2: -n Match3: Proc_20ms Match4: -c Match5: C:/Users/Braun/Desktop/test.csv Match6: -t Match7: Continue the simulation from the first line of the csv-file Match8: -j Match9: none Match10: -V Match11: errors and warnings (default) Match12: -d Match13: ,

Submitted by Braun - 9 years ago