Quick References
      ADO
      ASP
      CSS2
      HTML
      JavaScript
      Jet SQL
      VBScript
      WML
      WMLScript
      WSH
      XHTML
      XML DOM
      XSLT

Features
      Knowledge Base
      Tutorials

Partners
     ZVON.ORG
     XML
     Planet Source Code
     VisualBuilder
     Web Design
     Your HTML Source
     XML/XSLT Forums
     ASPAlliance
     Scripts
     
     Programmers Heaven
     Tek-Tips Forums
     Developer Fusion
     Code Project











PROPERTY:  RegExp::rightContextNetscape Only Feature


RegExp.rightContext
 

 
This property is the substring following the character most recently matched (i.e. everything that comes after it), and as a static property, is always used as RegExp.rightContext. Consider the following code. The regular expression consists of one or more vowels. The code searches the string "the fisherman" and matches the 'e' in 'the' printing the substring to the right of it: namely 'fisherman'. Then it searches the same string again starting from where it ended in the previous search (see the lastIndex property), this time matching the 'i' of 'fisherman' and printing the following substring 'sherman'.
 
Code:
rexp = /[aeiou]+/g
rexp("the fisherman")
document.write(RegExp.rightContext)
rexp("the fisherman")
document.write("<BR>" + RegExp.rightContext)

 
Output:
fisherman
sherman

 
NOTE:
 
The regular expression in the above example uses the flag 'g' to indicate a global search. If it wasn't there, the second search in the above example would start at the beginning of the string producing exactly the same match as the first search: namely 'fisherman'.

 


Copyright 1999-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information