Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- INSERT INTO `helppages`
- (`HelpPageID`, `ShowHelpItem`, `HelpRank`, `HelpCategory`, `HelpTitle`, `HelpDescription`, `HelpLink`, `HelpText`, `CMSHelpBar`, `CMSHelpBarAdditional`)
- VALUES (... characters (Too many to post here, but the expression below grabs all) ...
- );
- preg_match("#INSERT INTO `$SearchingTableName` ([!%&'-/:<=>@^`;sdw"#$()*+,.?[]{}()\|©]*?));rn#s", $uploadedfile, $matches);
- which gets all the information but I can't get it to stop at the end ");rn"
- also $SearchingTableName = helppages.
- preg_match("#INSERT INTO `$SearchingTableName` ([!%&'-/:<=>@^`;sdw"#$()*+,.?[]{}()\|©]*)(?!);rn)#s", $uploadedfile, $matches);
- $pattern = <<<EOD
- ~
- # definitions
- (?(DEFINE)
- (?<elt> [^"',)]+ | '(?>[^\']+|\.)*' | "(?>[^\"]+|\.)*" )
- (?<list> ( g<elt>? (?: s* , s* g<elt> )* ) )
- )
- # main pattern
- INSERT s+ (?:INTO s+)? `$SearchingTableName` s* g<list>? s* VALUES s*
- g<list> s* (?: , s* g<list> s* )* ;
- ~xs
- EOD;
- if (preg_match_all($pattern, $uploadedfile, $m))
- print_r($m[0]);
- [^"',)]+ # all that is not a quote a comma or a closing parenthese:
- # in the present context this will match numbers and column names
- | # OR
- '(?>[^\']+|\.)*' # string between single quotes (designed to deal with escaped quotes)
- |
- "(?>[^\"]+|\.)*" # same for double quotes
Add Comment
Please, Sign In to add comment