UMass Lowell Dept. of Computer Science

91.461 GUI Programming I

Fall 2015 Semester, Section 201

Prof. Jesse M. Heines

Notes for Class No. 23

The jQuery UI Tabs Widget, Automatic Ajax, Introduction to Regular Expressions, and Introduction to Assignment No. 9

Thursday, November 19, 2015

A video of this class is (or will be) posted at:   http://echo360.uml.edu/heines201516/guiprogramming1.html


Handouts and Materials


Openings / Announcements / Reminders


Class Notes


Introduction to the jQuery UI API  (conclusion)

Using Ajax with the Tabs Widget  (jQuery UI 1.8 by Dan Wellman, p. 82)

Simply add an href attribute to the underlying HTML

<li><a href="CourseDescriptionPanel.html">Information</a></li>


An Extended Tabs Widget Example of Using Styles and Options

The Website

The HTML to set up the tabs widget interface

The modified CSS file to style the website as I wished

 

Understanding Regular Expressions

Piazza Poll Results

What are they and why are they important?


Pattern Matching

RegEx Components

RegEx Example

Run this code


Regular expressions are made up of several parts

Normal characters

Character classes

Pattern Metacharacters

Metacharacter Interpretation Example
. Matches any single character except newline ".ba" matches barbara and yabba
[cccccc] Matches any single character listed in this set "[Vv]ariable[12]" matches variable1 and Variable2
[^cccccc] Matches any single character not listed in this set "value[^01]" matches valuex and value2 but not value1 or value0
[c-c] Matches any single character within the range in this set "age[5-8]" matches age5, age6, age7 and age8
$ Matches the end of a string (or line if the "m modifier is used) "txt$" matches test.txt but not test.txtfile
^ Matches the beginning of a string (or line if the "m modifier is used) "^ja" matches javascript and java but not Wow, Java’s cool!
* Matches 0 or more of the preceding regular expression "value[0-9]*" matches value1, value10 and value
+ Matches 1 or more of the preceding regular expression "value[0-9]+" matches value1 and value999, but not value
? Matches 0 or 1 of the preceding regular expression (i.e., optional) "html?" matches html and htm
{quantity} Matches exactly quantity of the preceding regular expression "value[0-9]{3}" matches value001, value010 and value123, but not value1
{min,max} Matches at least min but no more than max of the preceding regular expression "value[0-9]{3,5}" matches value001, log0011 and log12345, but not log35
| Matches either the expression on the left or the right of the | "Mr\.|Mrs\.|Ms\." matches Mr. or Mrs. or Ms.
Escape
Sequence
Interpretation
\' Single quotation mark
\" Double quotation mark
$ The $ sign
\a Alarm (a small bell sound)
\b Backspace
\e Escape
\E End \L, \Q, or \U
\f Form feed
\l Lowercase next character
\L Lowercase all following characters until \E
\n New line
\Q Backslash all following non-alphanumeric characters until \E
\r Carriage return
\t Tab
\u Uppercase next character
\U Uppercase all following characters until \E
\\ Single backslash
Escape
Sequence
Interpretation
\A Match the beginning of a string (same as ^ if /m is not used)
\B Match a non-word boundary
\b Match a word boundary (between \w and \W)
\cx Match control character x (for example, \cC matches Ctrl/C)
\d Match a digit character [0-9]
\D Match a non-digit character [^0-9]
\nnn An octal ASCII value
\s Match a white space character [ \t\n\r\f]
\S Match a non-white space character [^ \t\n\r\f]
\w Match a “word” (alphanumeric) character [a-zA-Z_0-9]
\W Match a non-word character [^a-zA-Z_0-9]
\xnn A hexadecimal ASCII value
\Z Match the end of a string or before a new line (same as $ if /m is not used)
\z Match the end of a string


Using Regular Expressions with JavaScript

Syntax

var re = /ab+c/ ;

Note that there are no quotes!

RegExs can be used with


Example use with the jQuery Validator

Run this code


Introduction to Assignment No. 9

Implementing Scrabble with drag-and-drop

You are welcome to help each other with graphics.  For example, here is part of a row containing blank squares and double word score squares:

Please Note



This is document http://jesseheines.com:8080/~heines/91.461/91.461-2015-16f/461-lecs/lecture23.jsp.  It was last modified on Friday, August 26, 2022 at 4:09 PM.
Copyright © 2022 by Jesse M. Heines.  All rights reserved.  May be freely copied or excerpted for educational purposes with credit to the author.