I had a look at regular expressions in PHP but I don't really understand how they work.
I have various strings like "1-title" , "1-1-secondTitle", "1-2-otherTitle", This goes up to three level ("1-2-1-text"), so on every string I have this formating and I would like to check if there is one, two or three number before the string starts and then output "0", "1" or "2".
So to make it clearer
"1-index" should return "0"
"3-1-text" should return "1"
"5-2-1-otherTitle" should return "2"
is it possible to check the number of char before the first letter on a string?