- Joined
- Sep 29, 2004
- Messages
- 1,417
- Reaction score
- 29
Anyone good with Regular Expressions, that can spare me 30 seconds of their time? Basically, I have bible reference strings that look like this:
Matthew 7:7-8
Proverbs 23:7
Ephesians 5:25
etc...
I want to split them into Book, and Reference, like:
$book="Matthew", $ref="7:7-8"
$book="Proverbs", $ref="23:7"
$book="Ephesians", $ref="5:25"
The closest I've got is:
$ref = ereg_replace("(.*)([0-9]*:[0-9]*)","\\2",$string);
$book = str_replace("$ref","",$string);
But for some reason, this seems to return:
$book="Matthew 7", $ref=":7-8"
... what am I doing wrong!?!
Thanks,
Neil
Matthew 7:7-8
Proverbs 23:7
Ephesians 5:25
etc...
I want to split them into Book, and Reference, like:
$book="Matthew", $ref="7:7-8"
$book="Proverbs", $ref="23:7"
$book="Ephesians", $ref="5:25"
The closest I've got is:
$ref = ereg_replace("(.*)([0-9]*:[0-9]*)","\\2",$string);
$book = str_replace("$ref","",$string);
But for some reason, this seems to return:
$book="Matthew 7", $ref=":7-8"
... what am I doing wrong!?!
Thanks,
Neil