Javascript [Electronic resources] : The Definitive Guide (4th Edition) نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Javascript [Electronic resources] : The Definitive Guide (4th Edition) - نسخه متنی

David Flanagan

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید







3.10 Regular Expressions


Regular expressions
provide a rich and powerful syntax for describing textual patterns;
they are used for pattern matching and for implementing
search and replace operations.
JavaScript has adopted the
Perl programming language syntax for
expressing regular expressions. Regular expression support was first
added to the language in JavaScript 1.2 and was standardized and
extended by ECMAScript v3.


Regular
expressions are represented in JavaScript by the RegExp object and
may be created using the RegExp( ) constructor.
Like the Date object, the RegExp object is not one of the fundamental
data types of JavaScript; it is simply a specialized kind of object
provided by all conforming JavaScript implementations.

Unlike the Date object, however, RegExp objects have a literal syntax
and can be encoded directly into JavaScript 1.2 programs. Text
between a pair of slashes constitutes a
regular expression literal. The
second slash in the pair can also be followed by one or more letters,
which modify the meaning of the pattern. For example:

/^HTML/
/[1-9][0-9]*/
/\bjavascript\b/i

The regular expression grammar is complex and is documented in detail
in Chapter 10. At this point, you need only know
what a regular expression literal looks like in JavaScript code.



    / 844