Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试从表中获取正则表达式字符串,但是一旦将其放入 preg_match 中,它就会引发有关意外“\”的错误。如果我直接使用完全相同的字符串,则没有问题。
以防万一你还没有解决这个问题;)
在您作为对另一个答案的评论发布的评论中,您出现了以下字符串:\\/\。我想第一个反斜杠转义了第二个反斜杠,尽管它可能应该转义斜杠,因为那是正则表达式分隔符。因为它不是,它被当作定界符(由于位置应该已经抛出错误)并且下面的反斜杠被当作修饰符 - 这是未知的。
\\/\