RedRobotHero
Technical User
I'm making a CGI script that will convert another file format into HTML with style tags.
In this format, (Xtags) there's two types of tags I want to use, one of the format
and one of the format
.
I want to deal with these codes in the order in which they appear from left to right. But I have to use different code for the two cases.
The approach I've thought to use is this:
Is this really the best approach? Or is there a better way for me to deal with this?
In this format, (Xtags) there's two types of tags I want to use, one of the format
Code:
<@[a-zA-Z]+>
Code:
@[a-zA-Z]+:
I want to deal with these codes in the order in which they appear from left to right. But I have to use different code for the two cases.
The approach I've thought to use is this:
Code:
while ((/<@[a-zA-Z]+>/)&&($c1=1)||
(/@[a-zA-Z]+:/)&&($c2=1)) {
if ($c1==1) {
deal with the tag and replace it with new tag.
};
if ($c2==1) {
deal with the other tag and replace it with new tag.
};
$c1=0;
$c2=0;
}
Is this really the best approach? Or is there a better way for me to deal with this?