Answer the question
In order to leave comments, you need to log in
regexp question
I have a large number of paragraphs starting with the same headings.
For example
Gen\r\n
text
Gen\r\n
text
Gen\r\n
text
Gen\r\n
text
I want to make sure that only the first one remains.
Gen
\r\n
text
text
text
text
Answer the question
In order to leave comments, you need to log in
so if they are the same, regular expressions are not needed. You can just replay. for example
$title='Gen\r\n';
$text='Gen\r\n
text
Gen\r\n
text
Gen\r\n
text
Gen\r\n
text';
echo $title.str_replace($title, '', $text);
Delete every second line after the first:
Regex.Replace(text, "(?<=\r\n)(.+\r\n)(.+)", "$1")
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question