我想捕获冒号存在的特定数据。我曾经尝试这样做:如何在php正则表达式中排除个案
preg_match_all("/^(.+):(.+)/im", $input_lines, $output_array);
该输入数据
last_name, first_name
bjorge philip: hello world
bjorge:world
kardashian, kim
some http://hi.com ok
jim https://hey.com yes
same http://www.vim.com:2018 why
it's about 20/08/2018 1:23 pm
time is 01:20:24 now
capture my name : my name is micky mouse
mercury, freddie
I need to be:
captured
capture me :
if you can
where is : freddie
freddie is not:
home
我需要捕获bjorge philip: hello world
,bjorge:world
,I need to be: captured
,capture me : if you can
,where is : freddie
,freddie is not: home
和capture my name : my name is micky mouse
线和排除包含任何时间任何线或URL
在你的例子'冒号空间'会起作用 – nogad
让你的生活更轻松,并且单独遍历每一行而不是尝试写出多行的正则表达式。 – Sammitch
@nogad该空间是可选的。对不起,我编辑我的例子 – Kal