===== Link Parsing ===== >>See also: ~-WantedFormatters ~-LinkTails >>::c:: This page is dedicated to discussions on the development of a **better link formatter**, i.e. a formatter supporting (optional) link titles, anchors, url parameters etc. I start posting some code that I'm using to test regex for parsing forced links. It should correctly parse links like the following ##""[[HomePage | (!Hello world;p=1&q=2) This is the home page with title]]""## giving something like this: "" This is the home page with title"". The parentheses are used to select ;-separated URL options, like title or URL parameters. The space before the parenthesis is optional. ##!Hello world## corresponds to the title. ##p=1&q=2## corresponds to the URL parameters. %%(php) Options: '; print_r($options); foreach($options as $option){ switch(true){ case (preg_match("/!(.+)/", $option, $istitle)): $title = $istitle[1]; break; case (preg_match("=", $option, $isparameter)): $parameters = $isparameter[0]; break; } } } else { echo '
Specified options are not valid'; } } else { print '
No options'; } echo '
Link chunks: '; print_r($matches); echo '
Rendered link: '.$this->Link($url, '', $desc, '', '', $title).'
'; } else { echo 'String does not match pattern'; } } else { print 'Please enter a string'; } ?> %% ---- CategoryDevelopmentFormatters