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.
我已经看过几篇关于将旧的转换为 的文章split(),但到目前为止preg_split()还没有一个带有分隔符的文章。/
split()
preg_split()
/
我将如何转换split('[-/.]')为preg_split()等价物?我的正则表达式知识很糟糕!
split('[-/.]')
谢谢你的帮助!
preg_split('~[-/.]~', ...
分隔符几乎可以是任何字符
如果您明确希望它是斜线 - 转义表达式中的所有斜线
preg_split('/[-\/.]/', ...
尝试这个
preg_split('#[-/.]#',"your_text")