Jessa Jane S. Romo Bsit-2 Javascript Perl: Elements Character Set
Jessa Jane S. Romo Bsit-2 Javascript Perl: Elements Character Set
Jessa Jane S. Romo Bsit-2 Javascript Perl: Elements Character Set
Romo BSIT-2
Elements JavaScript PERL Visual Basic .NET
Character Set The uppercase letters 'A' through 'Z' ASCII /[a-z]/, /[A-Z]/, /[0-9]/, /,’\.\?]/, /[A-Za-z/, /[A-Za- Character ::= < any Unicode character
('\u0041' through '\u005a'), zO-9]/, /[^a-z]/, /[^0-9/ except a LineTerminator >
The lowercase letters 'a' through 'z'
('\u0061' through '\u007a'),
The digits '0' through '9' ('\u0030' through '\u0039'),
The dash character '-' ('\u002d', HYPHEN-MINUS),
The period character '.' ('\u002e', FULL STOP),
The colon character ':' ('\u003a', COLON), and
The underscore character '_' ('\u005f', LOW LINE).
Identifiers Every name is made from the following characters, starting with #!/usr/bin/perl Visual Basic .NET identifiers conform to the Unicode
a letter:
$sessionId =""; Standard Annex 15 with one exception: identifiers
Letters: a-z, A-Z, and other alphabetic characters from $length=16; may begin with an underscore (connector) character.
other languages. If an identifier begins with an underscore, it must
for($i=0 ; $i< $length ;)
Digits: 0-9 { contain at least one other valid identifier character to
Special: _ (underscore) $j = chr(int(rand(127))); disambiguate it from a line continuation.
if($j =~ /[a-zA-Z0-9]/)
No names can be the same as a Java keyword { Regular identifiers may not match keywords, but
(eg, import, if, ...). $sessionId .=$j;
escaped identifiers can. An escaped identifier is an
$i++;
} identifier delimited by square brackets. Escaped
} identifiers follow the same rules as regular identifiers
except that they may match keywords and may not
print $sessionId; have type characters.
It's that simple. You can change the combination of letters Identifier ::=
and number used in the sessionId by changing this regular NonEscapedIdentifier [ TypeCharacter ] |
expression /[a-zA-Z0-9]/. And change it's length with the
$length variable. The longer the identifier the more likely EscapedIdentifier
that it's unique.
Operator Symbols + addition and String concatenation infix_operator::= "," | "=" | ".." | "||" | "&&" | "|" | "^" | Operator ::= & | * | + | - | / | \ | ^ | <
"&" | "<<" | ">>" | "+" | "-" | "." | "*" | "/" | "%" | "x" | | = | >
- subtraction "**" .
relational_operator::= "==" | "eq" | "!=" | "ne" | "<=>" |
star multiplication "cmp" | "<" | "lt" | ">" | "gt" | ">=" | "ge" | "<=" | "le".
pattern_binding_operator::= "=~" | "!~".
/ division assignment_operator::= "=" | infix_operator "=".
1. prefix::= "!" | "~" | "++" | "--" | "-".
% mod (remainder from integer division) 2. postfix::="++" | "--".
== equal
!= not equal
&& and
|| or
+ addition and String concatenation
Keywords & abstract boolean break byte case Keyword ::= < member of keyword table >
char class const continue default The next keyword jumps directly to the end of the
Reserved words -AddHandler,AndAlso, Auto, ByVal, Cbool,
double else extends final finally current iteration of the loop. This usually causes the CDbl, Class, CShort, Date, Delegate,
for goto if implements import Double, End, Error, ..etc
int interface long native new next iteration of the loop to be started, but
private protected public return short
the continue block and loop condition are evaluated
strictfp super switch synchronized this
throws transient try void volatile first.
Expression In Java, arithmetic, boolean, and String expressions are written Optional Expressions. An expression is a sequence of operators and
in conventional mathematical infix notation, adapted to the A part of an pattern can be made optional in a regular
standard computer character set (called ASCII). For example, expression with a ? operator. operands that specifies a computation of a value, or
the Scheme expression Example: that designates a variable or constant. This defines
(and (< (+ (* x x) (* y y)) 25) (> x 0)) RegEx: /[0-9]? This is sample/
is written in Java as Source Text1: /1 This is sample/ the syntax, order of evaluation of operands and
(x*x + y*y > 25) && (x > 0) SoCounted Expressions. operators, and meaning of expressions.
Like the C programming language, Java uses the symbol && for An interval expression, {m,n} where 'm' and 'n' are non- Expression ::=
the ``and'' operation on boolean values (true and false) and the negative integers with 'n >= m', applies to the proceeding SimpleExpression |
symbol == for the equality operation on numbers. (The character, character set, subexpression or backreference.
symbols & and = are used in C and Java for other purposes.) It indicates that the preceeding element must match at TypeExpression |
least 'm' times and may match as many as 'n' times. MemberAccessExpression |
Alternative expression is a one which matches any of DictionaryAccessExpression |
The arithmetic operators all use conventional computer
the specified list of patterns. This helps us to give OR IndexExpression |
arithmetic appropriate for the types of the arguments.
conditions in our patterns.
Conventional computer arithmetic does not exactly conform to NewExpression |
Example:
the standard mathematical conventions. For example, the CastExpression |
RegEx: /(TEXT|text)/
expression OperatorExpression
Source Text1: This is sample TEXT.
Source Text2: This is sample text.
5/3 Repeated Expressions.
produces the result To match a part of a pattern repeatedly for many times. It
1 is just like counted patterns but here it is more generic.
which is the quotient of 5 divided by 3. Integer division produces Operators used in Repeated Expressions:
an integer rather than rational result; it truncates to the decimal 1. * ( Asterix ) - Represents 0 or many times of matching.
representation of the rational result. Similarly, The expression 2. + ( Plus ) - Represents 1 or many times of matching.
5%3 Operator * represents that the pattern is optional and it
produces the result can come any times.
2 Operator + represents that the pattern is mandatory or
which is the remainder of 5 divided by 3. In Java program text, must and it can come any times.
spaces between symbols are ignored; the expression Example 1:
5/3 RegEx: /[0-9]+/
is equivalent to the expression Source Text1: 123 This is a sample text.
5/3 Result: It will match "123".
Statements <variable> = <expression>; A Perl statement ends with the semicolon character (;) The following code demonstrates where to place the
which is used to tell interpreter that the statement was Option statement.
complete. You can put one or more Perl statements on the
For Example:
same line of a Perl script or continue a statement on
several lines. Please look at the following example to see Option Strict Off
int height; some simple Perl statements: Imports System
height = 34; Module Module 1