A regular expression is a sequence of symbols and characters that represent a string or pattern searched within a longer piece of text.
_regex restricts the records that may be impacted to the ones where the regular expression exists.
Regular expressions are expressed in a string.
The following tables displays examples and results of applying filters with a regular expression. Some of the fields displayed are not mandatory and others have been omitted.
{
xtremMasterData {
item {
query(filter: "{name: {_regex: 'C.*a'}}") {
edges {
node {
id
name
}
}
}
}
}
}
|
{
"data": {
"xtremMasterData": {
"item": {
"query": {
"edges": [
{
"node": {
"id": "001",
"name": "Coffee Beans"
}
},
{
"node": {
"id": "101",
"name": "TestCottage Pie"
}
},
{
"node": {
"id": "Cable1",
"name": "Cable 1"
}
},
{
"node": {
"id": "Cable2",
"name": "Cable 2`"
}
}
]
}
}
}
}
}
|
{
xtremMasterData {
item {
query(filter: "{name:{_not: {_regex: 'C.*a'}}}") {
edges {
node {
id
name
}
}
}
}
}
}
|
{
"data": {
"xtremMasterData": {
"item": {
"query": {
"edges": [
{
"node": {
"id": "10",
"name": "myTest"
}
},
{
"node": {
"id": "1012",
"name": "onion"
}
},
{
"node": {
"id": "1013",
"name": "mince"
}
},
{
"node": {
"id": "102",
"name": "potato mash"
}
}
]
}
}
}
}
}
|