Reputation: 36217
I have a text line that is delimited by tabs and multiple spaces but not single spaces. I have found:
parsed = preg_split('/ +/', $line); // one or more spaces
which can a split a line with one or more spaces. Is there a regex for only more than 1 space but not exactly 1 space?
Upvotes: 2
Views: 2386
Reputation: 9819
Just use preg_split('/ +/', $line);
-- this is a blank followed by one or more blanks. Note that there are 2 blanks between the / and the +, even if it looks like one. Or, you could write it as '/ {2,}/'
, which also means previous expression (the blank) repeated at least 2 times.
Upvotes: 4