SoFunction
Updated on 2025-03-04

JS RegExp object attributes lastIndex, lastMatch, lastParen, lastContext, rightContext attribute explanation of js regular expression

JS RegExp object attributes lastIndex, lastMatch, lastParen, lastContext, rightContext attribute explanation of js regular expression

Updated: October 12, 2012 11:46:19 Author:
Explanation of the js regular expression RegExp object attributes lastIndex, lastMatch($&), lastParen($+), lastContext, rightContext attributes

Properties, return the last index position of the matching content, that is, the start position of the next match. Note that the string index starts from 0.
Code:


[Ctrl+A Select all Note:Introducing external Js requires refreshing the page before execution]

($&) attribute, read-only attribute, if there is no matching information, the value of this attribute is an empty string

[Ctrl+A Select all Note:Introducing external Js requires refreshing the page before execution]

Properties Read-only static property, which returns the value of the last submatch obtained in the last match detection, and returns an empty string if there is no submatch

[Ctrl+A Select all Note:Introducing external Js requires refreshing the page before execution]

Properties Returns the character information on the left side of the matching content. The initial value of the attribute is an empty string. If there is a corresponding value matching the attribute, it will change.

[Ctrl+A Select all Note:Introducing external Js requires refreshing the page before execution]

Properties Returns the character information on the right side of the matching content, read-only static attributes The initial value is an empty string. If there is a match, it returns the information on the right side of the matching content.

[Ctrl+A Select all Note:Introducing external Js requires refreshing the page before execution]
  • lastIndex
  • lastMatch
  • lastParen
  • lastContext
  • rightContext

Related Articles

  • Collect and organize regular expressions commonly used in projects

    The common regular expressions shared by this article are collected and compiled by the editor during daily project process. I will share them with you here for your reference
    2015-10-10
  • Several basic concepts of regularity

    Several basic concepts of regularity...
    2006-11-11
  • Asp's ubb function (recommended)

    asp's ubb function (recommended)...
    2006-06-06
  • Javascript Gets the regular expression of the url parameter (used to get a certain parameter value)

    JavaScript passes regular expressions of multiple parameters (used to get a certain parameter value). I previously posted that the code for obtaining url parameters through functions is not a regular expression.
    2010-01-01
  • JS basic tutorial—regular expression example (recommended)

    This article will share with you the basic regular expression knowledge of js, as well as the meaning of () [] {} in regular expressions. This article will introduce you very detailedly. For those who need it, please refer to it.
    2017-01-01
  • Detailed explanation of sub-patterns of php regular expressions

    Detailed explanation of the sub-pattern of php regular expressions, friends who learn php can refer to it
    2012-06-06
  • Regular expressions for several common attacks

    These regular expressions are used by some attacks to filter, which is really good. Friends who like them can study them, don't destroy them, it's for research and learning purposes only
    2013-09-09
  • Application of UBB code in forums

    UBB code application in forums...
    2006-07-07
  • Asp commonly used regular expressions implement string replacement

    Asp commonly used regular expressions implement string replacement, mainly including removing html tags, removing class tags and removing script tags, etc.
    2008-03-03
  • Analysis of the implementation of coolcode to SyntaxHighlighter and Mysql regular expressions

    The blog's code highlighting plugin was originally coolcode. The coolcode highlighting plugin is really cool and has a great display effect, but it occupies too much seat.
    2011-04-04

Latest Comments