Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
(?(DEFINE) (?<number> -? (?= [1-9]|0(?!\d) ) \d+ (\.\d+)? ([eE] [+-]? \d+)? ) (?<boolean> true | false | null ) (?<string> " ([^"\\\\]* | \\\\ ["\\\\bfnrt\/] | \\\\ u [0-9a-f]{4} )* " ) (?<array> \[ (?: (?&json) (?: , (?&json) )* )? \s* \] ) (?<pair> \s* (?&string) \s* : (?&json) ) (?<object> \{ (?: (?&pair) (?: , (?&pair) )* )? \s* \} ) (?<json> \s* (?: (?&number) | (?&boolean) | (?&string) | (?&array) | (?&object) ) ) \s* (?<tag> \@(?:[[:alnum:]])*) ) (?'actiontag' (?:\@(?:[[:alnum:]_-])*) ) (?:\= (?: (?: (?'params_json'(?&json)) ) | (?: (?'params'(?:[[:alnum:]_-]+)) ) ) )?
/
ixgm

Description

Parses @FOO=BAR, @FOO, and @FOO{"JSON":"OBJECT"} to be used in REDCap action tags for passing parameters to functions.

Submitted by Andrew Martin - 9 years ago