1
Actuellement, j'ai cette regex pour diviser un paragraphe en phrases: /[^\.!\?]+[\.!\?]+/g
. Le problème est que mes paragraphes ne sont pas seulement des paragraphes de texte. J'ai des liens en eux comme ceci:Comment construiriez-vous une regex qui divise un paragraphe en phrases, mais ne scinde pas la ponctuation qui est à l'intérieur de <>?
This is text and here is a <value="link" href="http://link.com?param=test"> which directs to another page. So I don't want to split at the anything inside the link above.
Je veux partager cela dans un tableau comme:
['This is text and here is a <value="link" href="http://link.com?param=test"> which directs to another page.', 'So I don't want to split at the anything inside the link above.']
Qu'est-ce regex faire?
Cela semble assez bien fonctionner, mais oublie le dernier texte si elle ne se termine pas dans la ponctuation prévue lors de la séparation. – Namey