GatoGraphQL / GatoGraphQL

Interact with all your data in WordPress using GraphQL
https://gatographql.com
GNU General Public License v2.0
358 stars 40 forks source link

Search and Replace Directive Pack #216

Closed leoloso closed 3 years ago

leoloso commented 3 years ago

Feature Request

Provide directives for searching/replacing the content in the field:

Context

These directives make it easy to replace content on the field, without modifying the behavior of the field.

Examples

In the post content, replace all URLs for www.mydomain.com using either http or no protocol, to use https:

{
  posts {
    content @regexReplace(
      regex: "^(http:\/\/)?www\.mydomain\.com(\/.*)?$"
      to: "https://www.mydomain.com$2"
    )
  }
}

And if the content in the DB is "<p>Click <a href="www.mydomain.com/blog/">here</a>.</p>", the response will be:

{
  "posts": [
    {
      "content": "<p>Click <a href=\"https://www.mydomain.com/blog/\">here</a>.</p>"
    }
  ]
}
leoloso commented 3 years ago

Closed due to inability to get sponsors to fund this feature.