B
balakrishnan.dinesh
Hi frnds,
Im having a problem in searching out a particular substring in a
string.
Here the code:
---------------------
<html>
<script>
var tmpString="[Wed May 3 18:25:14 2006] [192.168.1.61] [GET
/manual/en/images/down.gif] [304] [0] [] [396 msecs]";
var ip="[192.168.1.61]";
var arr=tmpString.match(ip)
(or)
var arr=tmpString.search(ip)
alert(arr);
</script>
<body>
</body>
</html>
So in my tmpString variable, i have the data like this with square
brackets,Now i want to compare the ip variable value with tmpString
contained ip value, due to this sqaure brackets im not able to compare
it accurately.I used "match" and "search" commands, both are not
useful. While using "search" , it is showing error if square bracket
used.using match it is returning some interger.
If im comparing with square brackets, then some other problems are
creating i.e, if i give 192.168.1.6 as ip variable value and compared
with tmpString value, then also it is showing output as the correct
one.
Can anyone give me a proper solution for this
Thanks
Dinesh....
Im having a problem in searching out a particular substring in a
string.
Here the code:
---------------------
<html>
<script>
var tmpString="[Wed May 3 18:25:14 2006] [192.168.1.61] [GET
/manual/en/images/down.gif] [304] [0] [] [396 msecs]";
var ip="[192.168.1.61]";
var arr=tmpString.match(ip)
(or)
var arr=tmpString.search(ip)
alert(arr);
</script>
<body>
</body>
</html>
So in my tmpString variable, i have the data like this with square
brackets,Now i want to compare the ip variable value with tmpString
contained ip value, due to this sqaure brackets im not able to compare
it accurately.I used "match" and "search" commands, both are not
useful. While using "search" , it is showing error if square bracket
used.using match it is returning some interger.
If im comparing with square brackets, then some other problems are
creating i.e, if i give 192.168.1.6 as ip variable value and compared
with tmpString value, then also it is showing output as the correct
one.
Can anyone give me a proper solution for this
Thanks
Dinesh....