joe12 Posted August 5, 2008 Share Posted August 5, 2008 I'm really not sure how to go about this because I have never actually looked into regex at all. But say I was to convert the following text exactly - At 08-04 23:34:14 the following fleets met in battle:: Attacker Lewis ([1:24:4]) Weapons: 0% Shields: 0% Armour: 20% Type S.Cargo Total 1 Weapons 5 Shields 10 Armour 480 Defender DarksuN ([1:19:5]) Weapons: 0% Shields: 0% Armour: 10% destroyed The attacker has won the battle! He captured 2.417 metal, 1.358 crystal, and 474 deuterium The attacker lost a total of 0 units. The defender lost a total of 0 units. At these space coordinates now float 0 metal and 0 crystal. And change it into something like this using regex - [center]The following fleets were engaged in battle! Attacker Lewis S.Cargo .::. 1 Defender DarksuN destroyed [color=red] [hr] The attacker has won the battle! [hr][/color] .::. What was stolen .::. [color=green]+2.417[/color] metal [color=green]+1.358[/color] crystal [color=green]+474[/color] deuterium Attacker Unit Loss .:. Defender Unit Loss .:. Debris Floating .:. 0 Metal, 0 Crystal [/center] If anyone could explain to me how I could do this, thanks. Quote Link to comment https://forums.phpfreaks.com/topic/118264-converting-some-text-into-a-formatted-text/ Share on other sites More sharing options...
effigy Posted August 5, 2008 Share Posted August 5, 2008 That's a tall order, especially not knowing what other combinations are possible. What have you tried? Quote Link to comment https://forums.phpfreaks.com/topic/118264-converting-some-text-into-a-formatted-text/#findComment-608695 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.