regular expressions – part ii 1. the exec method is more complicated than i realized, and something you will probably not use in this cours

Regular expressions – Part II
1. The exec method is more complicated than I realized, and something
you will probably not use in this course.
If pat is a regexp then pat.exec(target) examines target to see if it
has the expression described in pat and returns an array if there is a
match, or null otherwise.
If a=pat.exec(target) then a[0] is the matched text, a[1] is the text
which matches the first parenthesized subexpression in pat, a[2] is
the text which matches the second parenthesized subexpression in pat,
etc.
You may also step through all the results (matches) that exec() finds
– see handout from Flanagan’s JavaScript: the Definitive Guide.
2. pat.test(target) will return true (if there is a match) or false
(if there is no match).
3. The following characters must be escaped in regular expressions
defined with /s (but not when you define pat=new RegExp(“mystring”):
^ $ . * + ? = ! : | \ / ( ) [ ] { }
4. The following special characters are denoted with escape sequences:
\n newline (\u000A)
\t tab (\u0009)
\0 null (\u0000)
\v vertical feed
\f form feed
\r carriage return
\xnn any Latin character expressed in Hex as nn
\uxxxx any Unicode character expressed in Hex as xxxx
\cX the character ctl-X
[\b] a backspace
5. The following groups of characters are found in part I of Regular
Expressions:
\d digits \D non-digits
\s whitespace \S non white-space
\w alphanumeric, _ \w non-alphanumeric, non underscore
\b is a word boundary
Ex: From Danny Goodman’s JavaScript Bible
target=”Oh, hello, do you want to play Othello in the school play?”
var myRegExpression = /hello/;
In concert with some regular expression or string object methods, this
pattern matches the
string “hello” wherever that series of letters appears. The problem is
that this simple pattern
causes problems during the loop that searches and replaces the strings
in the example string:
It finds not only the standalone word “hello,” but also the “hello” in
“Othello
Fortunately, regular expressions provide a shortcut way to specify
general characteristics, including a feature known as a word boundary.
The symbol for a word boundary is \b (backslash, lowercase b). If you
redefine the pattern to include these specifications on both ends of
the text to match, the regular expression creation statement looks
like this:
var myRegExpression = /\bhello\b/;
When JavaScript uses this regular expression as a parameter in a
special string object
method that performs search-and-replace operations, it changes only
the standalone word
“hello” to “hi,” and passes over “Othello” entirely.
6. Exact matches: As you know from Part I, ^ requires that the match
be at the beginning of target, and $ requires that the match be at the
end. So
pat= /^Simmons$/
will match only when target is exactly the string Simmons.

  • 2008 YILINDA BEYANNAMELERİNİ İMZALATMAK ZORUNDA OLMAYANLAR NOTERLER ÖZEL KANUNLARINA
  • A) “PERIMETRO” (LE VIE INDICATE IN NERETTO SONO PERCORRIBILI)
  • CURRICULUM DE MATILDE BLANCO DATOS PERSONALES NOMBRE MATILDE
  • MEDIMED 18TH EDITION THE EUROMEDITERRANEAN DOCUMENTARY MARKET SITGES
  • DECLARACIÓN JURADA PROMESA DDª CON DNI JURO
  • LAB WEEK 6 EYES EARS NOSE AND MOUTH EYES
  • ARE YOU CONSTANTLY TRYING TO ENCOURAGE YOUR PRESCHOOL STUDENTS
  • TITLE V RENEWAL PROCESSING REVIEW THE TITLE V
  • ZAŁĄCZNIK NR 1 DO SIWZ NR SPRAWY ZPPN10015LNP (PIECZĘĆ
  • TIMBRADO DO EMISSOR DECLARAÇÃO DE HORÁRIO DE PESQUISADOR EM
  • SERVICIO DE COMEDOR INSCRIPCIÓN CURSO 201718 DATOS DEL
  • MANAGER MANAGE POST PRELIMINARY PROCESSING WORK INSTRUCTION PURPOSE THE
  • Pisanje Zadaća i Učenje Kako Pomoći Djetetu u Pisanju
  • TC ESKİŞEHİR OSMANGAZİ ÜNİVERSİTESİ MÜHENDISLIK MIMARLIK FAKÜLTESI DEKANLIĞI DIŞ
  • 1 LOS ALUMNOS REGALARON A SU PROFESOR UN RAMO
  • ПРИЦЕКРЫЛКА БРУКА (TROGONOPTERA BROOKIANA) МАЛАЗИЯ РАМКА (20Х21) ЦЕНА
  • RETURN OF TITLE IV FUNDS POLICY 1 US FEDERAL
  • IV CONSOLIDATED UNIVERSITY CODE OF STUDY AND EXAMINATION OF
  • DEPOSITS – SUPER WHAT CONTRIBUTION TYPES ARE
  • KILIC MAKİNE EKİPMAN HAVA KİLİDİ TAV MAKİNESİ VE KOVASI
  • 1 EFECTOS DE LA DECLARACIÓN DEL CONCURSO 2 SOBRE
  • CHAPTER 2 THE BASICS OF SUPPLY AND DEMAND CHAPTER
  • Ðïࡱáþÿ ¥áe Ø¿zûbjbjx83æx83æ ©^áx8cáx8c·òx94ÿÿÿÿÿÿx88 f
  • APPENDIX B TENNESSEE STATE UNIVERSITY SOCIAL WORK PROGRAM 3500
  • A UTO RADIADORES JOSE SL WWWAUTORADIADORESJOSEES 944723047944756253 SISTEMAS TERMICOS
  • ALERTA BIBLIOGRÁFICA – AGOSTO 2004 DERECHO PARA VER
  • CURSO DE AUTOCAD 2000 AREA INTERACTIVA LECCIÓN 10 BLOQUES
  • 20122013 PROSPECTIVE GRAND JURY QUESTIONNAIRE TRIAL COURTS EXECUTIVE OFFICERJURY
  • 2014 GADA 19FEBRUĀRĪ VISIEM IESPĒJAMIEM PRETENDENTIEM ATKLĀTS KONKURSS REMONTDARBU
  • RESERVADO C3088P (C3083P) 16 DE MAIO 2002 JUNTA INTERAMERICANA