Reputation: 5647
Hi i have the following group:
`group_id` int(10) unsigned NOT NULL,
`right_id` int(10) unsigned NOT NULL,
`group__right_value` enum('allow','deny') NOT NULL DEFAULT 'deny',
KEY `group_id` (`group_id`),
KEY `right_id` (`right_id`)
And i expected the strings to always end with a comma so a did a split based on that. Now i've noticed that in some cases like above the commas should be ignored and the values left as they are:
enum('allow','deny')
How should i exclude the commas between brackets when doing the split?
EDIT:
The expected result should be:
Upvotes: 0
Views: 183
Reputation: 173642
Matching a comma at the end of the string is done with an anchor:
/,$/m
The /m
modifier is used to enable multiline mode, in which $
will match the end of the line instead of the standard end-of-subject.
Upvotes: 1