I want to select text till the linebreak (or any other) is repeated twice
I tried to stop selection with [^n]*?
However, I like to do something that can select will two (or more) consecutive linebreaks are encountered
used regex in JS
/^(?!#{1,6}s|*s|d+.s|!|[|>+s+|-||)([^n]*?)n{1,}$/gmi
dummy text
select this First in a single line
select this second one line
select these multiline paragraph
including this I want to select these 3 line in one paragraph
However only last line is selected in a group I am using [^n]*?
# do not select anything below
> one line
> multiline paragraph
> secondline
> single
>> one line
>> multiline paragraph
>> secondline
>> single
# heading
---
|S.No|name|
|:---|---|---|
|1|prateek|
## headgin
* list
1. list
11. asdfli
![asdf](image)
[asd](heading)
2
Answers
If you are parsing Markdown, please consider using a parser instead of regex. The following regex should only be used in case you have no other choice as it cannot guarantee a correct match for every possible situation.
Try it on regex101.com.
^(?!s*$|#{1,6}s|*s|d+.s|!|[|>+|-||)([sS]*?)n{2,}
https://regex101.com/r/nrssCf/1
explain
s*$
match an empty line.n{2,}
two or more linebreak.