Luke G
Luke G

Reputation: 1747

WDVSS & regex validator

I am trying to get the following regex to work with Web Data Validation Standard Schema (WDVSS) and UserFrosting.

<soapenv:Envelope [\s\S.]*?<\/soapenv:Envelope>

It works perfectly fine on regex101.com with javascript flavour but UserFrosting does not like it, below is the schema used:

{
  "soapRequest" : {
    "validators" : {
      "regex" : {
        "regex" : "<soapenv:Envelope [\s\S.]*?<\/soapenv:Envelope>",
        "message" : "This is not a valid SOAP request."
      }
    },
    "sanitizers" : {
      "raw" : ""
    }
  }
}

My form contains a single textarea field for content of a SOAP request. With the regex I want to make sure that the content is in fact a SOAP request.

UserFrosting work fine with a very basic regex like the one below...

  "regex" : {
    "regex" : "<soapenv:Envelope.*",
    "message" : "This is not a valid SOAP request."
  }

... so the issue is likely to be with the regex.

Suggestions would be appreciated.

Upvotes: 0

Views: 36

Answers (0)

Related Questions