View Single Post
Old 12-05-2004, 08:29 PM   #4 (permalink)
Rafkin
Registered User
 
Rafkin's Avatar
 
Join Date: Mar 2004
Posts: 20
Rafkin is on a distinguished road
Ok, I just found some information on preg_replace command and regular expressions, wich I had at one time studied in perl, and should be able to re-familiarize myself with in php.

If I have any difficulties, I'll post here. I'm surprised there isn't a section under php on your site regarding regex.

Edit:
Ok, this is not gonna be easy. I started to create some patterns in regex to check against, but realized I was deleting a lot of the text without knowing it.

The difficult part is ignoring anything on a line after a * symbol.

What I want to do is turn this:
Quote:
* This comment brought to you by McDonalds. Have you had your break today?
(0:7) When somebody moves into position (24,43),
(1:4) and they bump into a Furre,
(3:4) within the rectangle (%position1) - (%position2),
(4:1) only where the floor is type 26,
(5:4) place object type @3.
(5:200) emit message {bunch of text} to whoever set off the trigger.
Into this:
Quote:
* This comment brought to you by McDonalds. Have you had your break today?
(0:7) When somebody moves into position (24,43),
(1:4) and they bump into a Furre,
(3:4) within the rectangle (%position1) - (%position2),
(4:1) only where the floor is type 26,
(5:4) place object type @3.
(5:200) emit message {bunch of text} to whoever set off the trigger.
I was trying to use
/^[^\*]*\(([0-5]):([0-9]+)\)/im

but suddenly realized anything before the (x:xx) would be deleted in the proccess because it matched the beginning of the string.

Is there any easier way to do this?

Last edited by Rafkin; 12-05-2004 at 10:23 PM.
Rafkin is offline   Reply With Quote