RegExp.index (javascript) not working in Mozilla browser

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sathya

    #1

    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 @ : narayanan@gsdin dia.com

  • Martin Honnen

    #2
    Re: RegExp.index (javascript) not working in Mozilla browser



    sathya wrote:
    [color=blue]
    > 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.[/color]

    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/

    Comment

    • sathya

      #3
      Re: RegExp.index (javascript) not working in Mozilla browser

      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 @; narayanan@gsdin dia.com

      Comment

      Working...