Skip to content

Instantly share code, notes, and snippets.

@mgng
Created Jul 11, 2012
Embed
What would you like to do?
空文字またはうんこに一致する正規表現
<?php
if ( $str === "" || $str === "うんこ" ) {
// match
}
<?php
if ( preg_match( "/\A(.{0}|うんこ)\z/u", $str ) === 1 ) {
// match
}
<?php
if ( preg_match( "/\A(|うんこ)\z/u", $str ) === 1 ) {
// match
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment