I have the following string :
abc:def abc:ghi abc:jkl
How can I check if my first occurence start with "abc:"? The string has no space except tabulations (\t). This is the result I need :
abc:def abc:ghi abc:jkl // true
foo:def abc:ghi abc:jkl // false
def abc:ghi abc:jkl // false
abc:def foo:ghi jkl // true
Also, i need to check the others parts if needed. For example if i need to check the 2st part :
abc:def abc:ghi abc:jkl // true
foo:def bar:ghi abc:jkl // false
def ghi abc:jkl // false
foo:def abc:ghi jkl // true
I tried preg_match("/abc\:([^\t]+)/",$data,$match);
it's worked but this code also return true
if the others occurences contains "abc:". Thank you!
EDIT : I'm sorry but this is not a duplicate question. Please see the the second part of my issue. In this second part i'm not requesting how get an element in the first occurence. PHP startsWith() and endsWith() functions has not the solution to this second part of my issue. Thank you.