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

Check if the word matches the required parameters

PHP 7.4.
How can I check if a word has the following form -> #tag. Here the ‘tag’ cannot contain any characters, only letters and numbers. The # must be present at the beginning of the word

>Solution :

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

Maybe this one

if (preg_match('/^#[a-zA-Z0-9]+$/', $a)) {
    echo "Valid";
} else {
    echo "NOT valid";
}
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