You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I suggest add feature for normalization line breaks. RegEx have modifier \R that matches any Unicode newline sequence. Equivalent to (?>\r\n|\n|\x0b|\f|\r|\x85). And the sources texts are sometimes very unpredictable with line breaks.
May be conside normalization method something like
/** * Normalizes all line endings in this string by using a single unified newline sequence (which may be specified manually) * * @param string $text source text for normalize * @param string|null $newlineSequence the target newline sequence to use (optional) * @return string normalized text */publicfunctionnormalizeLineEndings($text, $newlineSequence = null) {
if ($newlineSequence === null) {
$newlineSequence = "\n";
}
return\preg_replace('/\R/u', $newlineSequence, $text);
}
I suggest add feature for normalization line breaks. RegEx have modifier
\R
that matches any Unicode newline sequence. Equivalent to (?>\r\n|\n|\x0b|\f|\r|\x85
). And the sources texts are sometimes very unpredictable with line breaks.May be conside normalization method something like
(С) Borrowed this handy solution from the library https://github.com/delight-im/PHP-Str
The text was updated successfully, but these errors were encountered: