Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Regex Omit and Validate

I have this string

"<p></p>" fixed

Is it possible to have a regex that would omit the 7 characters and check if there are at least 3 characters in between?

"<p></p>" = false
"<p>   </p>" = false
"<p>Hello</p>" = true 
"<p>Hello </p>" = true

Further details:-
By default, my editor has the p tags. Therefore my validator is always returning editor string value is not empty. So I want to add the regex expression in the matches fx.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

string().required().matches()

>Solution :

I think this is what you look for:

^<p>[\S]{3,}<\/p>$  

if whitespaces are ok for you as well it is this one:

^<p>.{3,}<\/p>$
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading