A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://json-schema.org/understanding-json-schema/reference/regular_expressions.html below:

JSON Schema - Regular Expressions

Regular Expressions

The pattern and patternProperties keywords use regular expressions to express constraints. The regular expression syntax used is from JavaScript (ECMA 262, specifically). However, that complete syntax is not widely supported, therefore it is recommended that you stick to the subset of that syntax described below.

Example

The following example matches a simple North American telephone number with an optional area code:

schema

{ "type": "string", "pattern": "^(\\([0-9]{3}\\))?[0-9]{3}-[0-9]{4}$"}

compliant to schema

compliant to schema

"(888)555-1212 ext. 532"

not compliant to schema

not compliant to schema

The following example checks that the string starts with {{ and ends with }} and that it also allows multiline strings.

schema

{ "type": "string", "pattern": "^\\{\\{(.|[\\r\\n])*\\}\\}$",}

compliant to schema

not compliant to schema

Need Help? Did you find these docs helpful? Help us make our docs great!

At JSON Schema, we value docs contributions as much as every other type of contribution!

Still Need Help?

Learning JSON Schema is often confusing, but don't worry, we are here to help!.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4