wpseek.com
WordPress开发者和主题制作者的搜索引擎



rest_validate_json_schema_pattern › WordPress Function

Since5.6.0
已弃用n/a
rest_validate_json_schema_pattern ( $pattern, $value )
参数: (2)
  • (string) $pattern The pattern to match against.
    Required: Yes
  • (string) $value The value to check.
    Required: Yes
返回:
  • (bool) True if the pattern matches the given value, false otherwise.
定义在:
文档:

Validates if the JSON Schema pattern matches a value.



源码

function rest_validate_json_schema_pattern( $pattern, $value ) {
	$escaped_pattern = str_replace( '#', '\\#', $pattern );

	return 1 === preg_match( '#' . $escaped_pattern . '#u', $value );
}