I need to detect more than one \n. Doesn’t matter if it’s 2 or 1000, as long as it’s more than one \n. What would be the regex for this (if regex is necessary that is)?
EDIT
I am using this:
$pregmatch = preg_match('#\\n\\n+#', $locations);
if ($pregmatch > 0) {
echo 'more than one, this many: '.count($pregmatch);
} else
echo 'less than one';
but count($pregmatch) doesn’t return the actual number of more than one \n detected. How can that be achieved?
Are you looking for more than 1
\nin general? if so:Or without regex:
Or even (but it’s far less efficient):
If in a row:
Edit: So, based on your edit, I can summize two possibilities about what you want to know.
If you want to know the number of
\ncharacters in a row (more than 1), you could do:Or, if you wanted to know for each occurance: