2016-04-11 50 views
1

我寫了一個JSON的正則表達式URL重定向驗證JSON正則表達式錯誤

"redirect_uri": { 
     "type": "string", 
     "pattern": "^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,8})([\/\w \.-]*)*\/?$", 
     "description":"Application redirect_uri" 
     }, 

我收到此錯誤字符串

非法反斜槓轉義序列,在字符偏移1223(之前的「\ DA-Z \ .-] +)\。([a -...「)

我在哪裏犯錯誤。一切似乎沒什麼問題

回答

0

我不知道它是否滿足你的模式要求,但,這是一個有效的JSON:

"redirect_uri": { 
    "type": "string", 
    "pattern": "^(https?:\/\/)?([\\da-z\\.-]+)\\.([a-z\\.]{2,8})([\\/\\w \\.-]*)*\\/?$", 
    "description": "Application redirect_uri" 
} 

我只是添加哪裏需要一些逃生\。 我建議使用一些在線的JSON驗證器網站,如:http://jsonlint.com/

+0

謝謝你的工作 – shashank

+0

不客氣;-) – ItayB