mardi 30 juin 2020

How to tell if a string contains HTML tags or spaces in JavaScript? [duplicate]

I have a regex to test for HTML tags:

const isValueInvalid = /(<([^>]+)>)/gi.test(value);

But I need to test for spaces (whitespace) in the string as well.

How do I update the regex to cater for that case?

Aucun commentaire:

Enregistrer un commentaire