Regular Expression Help
Posted: Wed Jun 25, 2003 4:01 pm
[Admin Edit: Moved from viewtopic.php?p=46776]
this seems like a good place to post this....
i'm trying to get it to replace all instances of < and > as html tags in this:
<script>test one</script>this is a test< script >test 2 </script> this is a test<script language="javascript">test 3</script>
i expect most ppl using my site will use ie, so i'm testing it there...
in mozilla it works on everything bu the one where there' sa language and then mozilla adds a close tag itself on the redisplay.
in ie it's worse.. the first eregi only does the frist instance.
the second one only does something quite different.
the second one in mozilla:
this seems like a good place to post this....
Code: Select all
<?php
$input=stripslashes(rawurldecode($_GET['input']));
# $test=eregi_replace('<([[]+]?script[[]+[]*]?)>', '<\1>', $input);
$test=eregi_replace('<([[]+]?/?script[[]+[]*]?)>', '<\1>', $input);
?>last input: <?php echo $input; ?>
<br> after eregi: <?php echo $test; ?><br />
<p><form action="<?php $_SERVER[PHP_SELF]; ?>">
<br><input type="text" size="50" name="input"><br />
<br><input type="submit"><br /></p><script>test one</script>this is a test< script >test 2 </script> this is a test<script language="javascript">test 3</script>
i expect most ppl using my site will use ie, so i'm testing it there...
in mozilla it works on everything bu the one where there' sa language and then mozilla adds a close tag itself on the redisplay.
in ie it's worse.. the first eregi only does the frist instance.
the second one only does something quite different.
the second one in mozilla:
in mozilla you get to enver new output... in ie....last input: this is a test< script >test 2 this is a test
after eregi: <script>test one</script>this is a test< script >test 2 </script> this is a testtest 3</script>
and you don't get to add output.. which means it's either the same and mozilla's smart enough to close it, or something else.. but it's failing at the same place. if i could get some help..namely an explantion why, i would appreciate itlast input: this is a test< script >test 2 this is a test
after eregi: <script>test one</script>this is a test< script >test 2 </script> this is a test