Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE2 (PHP >=7.3)

~
^<[a-z]+\s+([a-z-]+\s*=\s?"[^"]+"\s*)*>(.+</[a-z]+>)?
~

Description

$subject = '<input type = "text" class="a-sdsd" name="name">asdasdsdsa</input>'; $pattern = '^<[a-z]+\s+([a-z-]+\s*=\s?"[^"]+"\s*)*>(.+</[a-z]+>)?';

Submitted by anonymous - 2 years ago