Hi I need to match a character string which can have 0+ hyphens in between the characters. I'm using PHP preg-match to do this. The characters can be upper or lowercase. Here's a few examples:
TESTTESTtest published successfully
test-TEST-test published successfully
Test-test published successfully
My regex needs to capture all these different cases.
I am going through a log line by line and trying to match the regex below to each line.
This is my current if statement:
if(preg_match('/(\w*) published successfully/',$line,$matches){
}
I just used \w* as my character capture as I didn't need to worry about hyphens before but I need to adapt this to handle the new scenario. Can anyone help me out?
expode("-", $s)does not work?[\w-]*? Do you have to worry about cases like------ published successfully?