A
a_the_s
Forethought: I'm using FreeBSD 5.1, gcc 3.2.1
The program takes a string (completely unaware of its contents), parses out HTML, then sends it on its way.
Simply put - is there an {easy} way to evaluate a regular expression on a string, read the results, then replace each of the results?
Technically put...
What I'm trying to do is easily accomplished in perl with something like..
$string_var = s/PATTERN/REPLACEMENT/{flags};
Those used to sed will recognize the s/// format. Unfortunately, I'm not using perl for this program.
My first attempt at solving the problem was using regex() and regcomp(). Unfortunately, I wasn't able to find a function to replace the substrings for me (yes, it seems lazy).
Then, looking back on the perl example, I figured I'd -sed- it. This works just fine, but, since the program won't know what's in the string, running a system command with the string in it may cause a security leak. Sooooo..that runs in to a bunch of garbage with piping.
ick.
The program works fine now, with the second example of piping to sed. But there has to be an easier way. Thanks for input!
-Elliot
--
"Serpent!" screamed the Pigeon.
"I'm not a serpent!" said Alice indignantly. "Let me alone!"
"Serpent, I say again!" repeated the Pigeon, but in a more subdued tone, and added with a kind of sob, "I've tried every way, and nothing seems to suit them!"
- L. Carroll
-==++==++==++==++==++==-
"Always the hours."
--
"Serpent!" screamed the Pigeon.
"I'm not a serpent!" said Alice indignantly. "Let me alone!"
"Serpent, I say again!" repeated the Pigeon, but in a more subdued tone, and added with a kind of sob, "I've tried every way, and nothing seems to suit them!"
- L. Carroll
-==++==++==++==++==++==-
"Always the hours."
The program takes a string (completely unaware of its contents), parses out HTML, then sends it on its way.
Simply put - is there an {easy} way to evaluate a regular expression on a string, read the results, then replace each of the results?
Technically put...
What I'm trying to do is easily accomplished in perl with something like..
$string_var = s/PATTERN/REPLACEMENT/{flags};
Those used to sed will recognize the s/// format. Unfortunately, I'm not using perl for this program.
My first attempt at solving the problem was using regex() and regcomp(). Unfortunately, I wasn't able to find a function to replace the substrings for me (yes, it seems lazy).
Then, looking back on the perl example, I figured I'd -sed- it. This works just fine, but, since the program won't know what's in the string, running a system command with the string in it may cause a security leak. Sooooo..that runs in to a bunch of garbage with piping.
ick.
The program works fine now, with the second example of piping to sed. But there has to be an easier way. Thanks for input!
-Elliot
--
"Serpent!" screamed the Pigeon.
"I'm not a serpent!" said Alice indignantly. "Let me alone!"
"Serpent, I say again!" repeated the Pigeon, but in a more subdued tone, and added with a kind of sob, "I've tried every way, and nothing seems to suit them!"
- L. Carroll
-==++==++==++==++==++==-
"Always the hours."
--
"Serpent!" screamed the Pigeon.
"I'm not a serpent!" said Alice indignantly. "Let me alone!"
"Serpent, I say again!" repeated the Pigeon, but in a more subdued tone, and added with a kind of sob, "I've tried every way, and nothing seems to suit them!"
- L. Carroll
-==++==++==++==++==++==-
"Always the hours."