php - Regex matching any successive lines starting with dash -


i have following string:

- give on result - second new text - third text  paragraph without list.  -new list here 

i need regex matches successive lines starts dash - so, should returns 2 matches, i.e first 3 lines , last line. have tried /(-(.*)\n\s*\n)*/gum matches last line of the first 3 lines the third text , this demo

what about

(-(.*))(\n-(.*))* 

regex101 demo

your regex has 2 new lines (\n\s*\n).


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Website Login Issue developed in magento -

Can the constants be defined inside a model file of a framework in PHP? -