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

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -