Here are some examples:
Some text A
Some text A 8:00-19:00
8:00-19:00
Some text A 8:00-19:00 Some text B
For each case described above, I need to capture (if possible):
- The time (
8:00-19:00
) - The beginning (
Some text A
) - The end (
Some text B
)
With this pattern #^(.*?) ?(\d{1,2}:\d{2}-\d{1,2}:\d{2})?$#
, I can capture (from example 2):
Some text A
8:00-19:00
But I can't capture the rest of the line by adding (.*)
or (.*?)
at the end of the pattern.
Can you help me? Thank you!