473,657 Members | 2,758 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

RegExp.index (javascript) not working in Mozilla browser

hi,

i am using regexp.index in my javascript, IE supports this value but
mozilla gives undefined value for regexp.index. Is there any equivalent
method we can use for mozilla browsers.

regards,
sathya narayanan
mail @ : na*******@gsdin dia.com

Jul 23 '05 #1
2 2385


sathya wrote:
i am using regexp.index in my javascript, IE supports this value but
mozilla gives undefined value for regexp.index. Is there any equivalent
method we can use for mozilla browsers.


I think you are looking for the index property of the result of an exec
call e.g. if you have a regular expression object
var pattern = /Kibo/g;
then you can call the exec method and check the index property of the
result returned by that method:
var match = pattern.exec('A ll for Kibology');
if (match != null) {
alert(match.ind ex);
}
That should work across browsers.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2
hi martin,
thankyou for your hlp...
I have another problem , i wabt to find index of my stratind and ending
tag in javascript , my word tag is as follow:

<zone>bla bla bla </zone>

i tried using regular expresion and i got result for IE browser , but
when i tried to implement my code in mozilla it shows bug in finding
index </zone> tag...
is there any solution for this problem...
plz help very urgent..
mail @; na*******@gsdin dia.com

Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
5129
by: Steve W | last post by:
I've searched over and over again and have not been able to find a definitive answer. Basically, we have a heavily JavaScripted web site. What I was hoping to do was to start enhancing our site by calling some Java functions via JavaScript. I have tried every sample I could find on the net and none of them works with Mozilla or Explorer. I've read 4 or 5 books on Java and JavaScript programming and none of the code in them works any...
5
1761
by: Florian Proch | last post by:
Hi all... i'm currently working for a big project to construct a website. We need to support some browser and OS : IE 5.0 -> IE 6, Mozilla 1.2 -> 1.7, Opera 5 -> Opéra 7.5x, Netscape 4.75 -> NS 7.2, Safari and for OS : Win95/98/NT/Me/2000/XP, MacOS 9/10, Linux. I have some problems with browser on different OS. For example i have write a javascript who make a automatic submit when the page is reload.
20
3526
by: RobG | last post by:
I'm messing with getPropertyValue (Mozilla et al) and currentStyle (IE) and have a general function (slightly modified from one originally posted by Steve van Dongen) for getting style properties: function GetCurrentStyle( el, prop ) { if ( window.getComputedStyle ) { // Mozilla et al return window.getComputedStyle(el, '').getPropertyValue(prop) ); } // IE5+ else if ( el.currentStyle ) {
1
2833
by: oreng | last post by:
Hey all, I have some problems detecting whether the client's browser javascript is enabled at the server side. While Request.Browser.JavaScript only check if the browser enable java script (and so on with Request.Browser.Cookies). I saw some server controls that register a startup script on the page_load and then perform a postback and run the javascript,changing a hidden
7
2560
by: iannorton | last post by:
Hi, I'm trying to write a RegExp that will return search an array and return the closest 10 matches, for example, if i entered "Hel" and my array contained "Hello", "Hell", it would return Hello and Hell, however, if i entered "ell" it wouldn't return anything. The code that i need to modify is: - var searchterm = "Hel";
2
4744
by: brad | last post by:
Hello all, I'm new to javascript--not too new to a few other programming languages--and I need your help deciphering the Regexp in the following string. Regular expresions are hard enough in Python, and since I am new to javascript they are even harder. Well here's the string, thanks for any and all help I receive. document.URL.match(/^(.+?)(?:\?(?:(.*?)@)?(.+))?$/)
2
14661
by: Uldis Bojars | last post by:
Hi All, I have encountered problems with JS RegExp.exec() and can't find what is the problem. Could you help me? formRequest is a function that extracts some information from XMLHTTPRequest response. A very strange effect (and I can't find where I've done something wrong) is that regexp matches in this function fail on every second call.
2
6140
by: arungenesis | last post by:
Hello people, I'm working with HTML and Javascript. I have some problems in handling frames. I have the following questions: 1. How do I retrieve the name of a FRAME in IE & Mozilla using a onclick event handler I have done this for IE and it is as follows: this.frames.name
4
3899
by: Matt | last post by:
Hello all, I have just discovered (the long way) that using a RegExp object with the 'global' flag set produces inconsistent results when its test() method is executed. I realize that 'global' is not an appropriate modifier for the test() function - test() searches the entire string by default. However, I would expect it to degrade gracefully. Instead, I seem to be getting something as follows - using W3Schools handy page at :
0
8385
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8303
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8821
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8502
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8602
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1941
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.