dqw7121 2017-08-17 02:43
浏览 65

用于验证输入的youtube或soundcloud url的正则表达式具有正确的语法

I am doing this in laravel php framework. Here is the relevant part that does the validation:

$this->validate($request, [
      'portrait_url' => 'required|active_url|regex:https://soundcloud.com/*',
      'video_url' => 'required|active_url|regex:https://www.youtube.com/user/*',
    ]);

Unfortunately I get the error that says:

preg_match(): Delimiter must not be alphanumeric or backslash

I think I am not writing my regular expression well. A hint please on the right regex pattern to accomplish my purpose. Particularly for youtube I want to verify that the entered url is the one that looks like this: https://www.youtube.com/user/OfficialSinach the phrase OfficialSinach could be replaced by any other username depending on the user being accessed.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥30 Unity接入微信SDK 无法开启摄像头
    • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
    • ¥20 cad图纸,chx-3六轴码垛机器人
    • ¥15 移动摄像头专网需要解vlan
    • ¥20 access多表提取相同字段数据并合并
    • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
    • ¥20 Java-Oj-桌布的计算
    • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
    • ¥20 有人知道这种图怎么画吗?
    • ¥15 pyqt6如何引用qrc文件加载里面的的资源