I hope that someone can give me the solution
Posted: Sat Aug 31, 2013 7:57 am
Hello,
I'm a beginner with regex. I have a peace of code and there they use regex with preg_replace and preg_replace_callback.
- This is my string: 21 sep 15:30: team 1 - team 2
- At the moment (I have tried a lot) this is my regex: #((\d*) (.{3}))( (\d{2}):(\d{2}):)(.*)(\s\-\s)(.*)#
- And this is the result with preg_match:
array[0] - 21 sep 15:30: WSV DS 1 - Favorita DS 1
array[1] - 21 sep
array[2] - 21
array[3] - sep
array[4] - 15:30:
array[5] - 15
array[6] - 30
array[7] - team 1
array[8] - -
array[9] - team 2
What I want is this:
array[0] - 21 sep
array[1] - 15:30:
array[2] - team 1
array[3] - -
array[4] - team 2
Can somebody help me to get this in the right direction?
Thanks.
Nioc
I'm a beginner with regex. I have a peace of code and there they use regex with preg_replace and preg_replace_callback.
- This is my string: 21 sep 15:30: team 1 - team 2
- At the moment (I have tried a lot) this is my regex: #((\d*) (.{3}))( (\d{2}):(\d{2}):)(.*)(\s\-\s)(.*)#
- And this is the result with preg_match:
array[0] - 21 sep 15:30: WSV DS 1 - Favorita DS 1
array[1] - 21 sep
array[2] - 21
array[3] - sep
array[4] - 15:30:
array[5] - 15
array[6] - 30
array[7] - team 1
array[8] - -
array[9] - team 2
What I want is this:
array[0] - 21 sep
array[1] - 15:30:
array[2] - team 1
array[3] - -
array[4] - team 2
Can somebody help me to get this in the right direction?
Thanks.
Nioc