nhoizey’s Twitter Archive
—№ 103,111
⇤ Newest
Tweet
⇠ Newer
Tweet
Older
Tweet
⇢
What’s the best (simple to read, efficient) JavaScript regex to get the first paragraph of an HTML string? I have this one: /<p>((?!(<\/p>)).|\n)+<\/p>/m Live:
regexr.com/4pm6n
On twitter.com
2019 Nov 27
Mood +
3
🙂
…in reply to @nhoizey
Better: /(<p( [^>]*)?>((?!(<\/p>)).|\n)+<\/p>)/m
regexr.com/4pm6n
Permalink
On twitter.com
2019 Nov 27
Mood +
2
🙂