Regular Expressions 101

Library entries

Command handling

Vote

3

Regular Expression
pcre

/
#Command handler #=============== #Start of the line ^ #Match the command name (?<cmd>[\w\d\-\_\?]+) #Catch as many parameters as possible (?<params> ( \ + (?<pre>[^\-\\\/\w\d\s\n\r]?) [^\"]*\k<pre> )* )? #Catch as many switches as possible and save them into group (?<switches> ( \ + #Switch starts with -- or - or / (?:\-\-|\-|\/) #Gotcha! [\w\d\_]+ )* )? #At the end of the line can be some spaces \ *$ #End of the line
/
gmx

Description

Loading markdown...
Submitted by anonymous - 7 years ago