Jump to content

Converting some text into a formatted text


joe12

Recommended Posts

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.