• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/59

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

59 Cards in this Set

  • Front
  • Back
regular expression (def)
provides a concise and flexible means to "match" (specify and recognize) strings of text, such as particular characters, words, or patterns of characters. Common abbreviations for "regular expression" include regex and regexp
look for all Jennifer/Jen/Jenny followed by last name
(Jeniffer!Jen!Jenny)\b\w+\b
Python use of regex
import re
f = open('file.txt')
strToSearch = ""
for line in f:
strToSearch != line
print(strToSearch) --- in A018sdakldsakd
pathFinder1 = re.compile('A018')

findPat1 = re.search(patFinder1, strToSearch)

printf(findPat1.group()) --out A018
printf(findPat1.start()) --out 0
printf(findPat1.end()) --out 4
printf(findPat1.span()) --out (0,4)
? indicate
The question mark indicates there is zero or one of the preceding element. For example, colou?r matches both "color" and "colour".
* indicates
The asterisk indicates there is zero or more of the preceding element. For example, ab*c matches "ac", "abc", "abbc", "abbbc", and so on.
+ indicates
The plus sign indicates there is one or more of the preceding element. For example, ab+c matches "abc", "abbc", "abbbc", and so on, but not "ac"
JS function to process regex
function editNodeText( regex, input, helpId, helpMessage)
(a|b)*
denotes the set of all strings with no symbols other than a and b, including the empty string: {ε, a, b, aa, ab, ba, bb, aaa, ...}
ab*(c|ε)
denotes the set of strings starting with a, then zero or more bs and finally optionally a c: {a, ac, ab, abc, abb, abbc, ...}
(empty set) ∅ denoting the set ∅.
ε
(empty string) ε denoting the set containing only the "empty" string, which has no characters at all.
a
(literal character) a in Σ denoting the set containing only the character a.
escape character
A number of special characters or meta characters are used to denote actions or delimit groups; but it is possible to force these special characters to be interpreted as normal characters by preceding them with a defined escape character, usually the backslash "\". For example, a dot is normally used as a "wild card" metacharacter to denote any character, but if preceded by a backslash it represents the dot character itself
pattern c.t matches
"cat", "cot", "cut", and non-words such as "czt" and "c.t"; but c\.t matches only "c.t"
.
Matches any single character (many applications exclude newlines)
a.c matches ?
"abc"
[a.c] matches ?
"a", ".", or "c"
[ ] matches ?
A bracket expression. Matches a single character that is contained within the brackets. For example, [abc] matches "a", "b", or "c". [a-z] specifies a range which matches any lowercase letter from "a" to "z".
[abcx-z] matches ?
"a", "b", "c", "x", "y", or "z"
[a-cx-z] matches ?
"a", "b", "c", "x", "y", or "z"
[^ ]
Matches a single character that is not contained within the brackets
[^abc] matches
[^abc] matches any character other than "a", "b", or "c"
^ matches
Matches the starting position within the string. In line-based tools, it matches the starting position of any line.
$ matches
Matches the ending position of the string or the position just before a string-ending newline. In line-based tools, it matches the ending position of any line.
* matches
Matches the preceding element zero or more times. For example, ab*c matches "ac", "abc", "abbbc", etc
[xyz]*
"", "x", "y", "z", "zx", "zyx", "xyzzy"
.at matches
matches any three-character string ending with "at", including "hat", "cat", and "bat".
[hc]at matches
[hc]at matches "hat" and "cat".
[^b]at matches
[^b]at matches all strings matched by .at except "bat".
^[hc]at matches
"hat" and "cat", but only at the beginning of the string or line.
[hc]at$ matches
"hat" and "cat", but only at the end of the string or line.
\[.\]
matches any single character surrounded by "[" and "]" since the brackets are escaped, for example: "[a]" and "[b]".
Set
"Handel"
"Hondel"
"Haendel"
what pattern matches this
H(o|ae?)ndel
boolean or
grey|gray
Grooping
gray|grey <=> gr(a|e)y
\s
expr for space
\w
expr for character
\.
any character possib;e
\d
any number
\D
anything but a number
\s
space
\S
anything but a space
0 or 1 repetitions of whatever code precedes it
\?
zero or more repetitions of whatever code precedes it
\*
n repetitions repetition of whatever code precedes it
{n}
[a-z]
1 of any lower case
all sentences that start with Cat
[^Cat\s\w+$]
php use of regex
$matchName = $reg.grep("%patterntoserach%", $randomArray);

for each ($matchName as $result)
{ echo $reset, "<br /> <br />";
}
^ matches
begining of a text
email pattern match
[A-Za-z0-9._\%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}
match pattern string - must have at lease 1 upper case letter
\A(?=[-_a-zA-Z0-9]*?[A-Z])
This string must have at lease 1 upper case letter
match pattern string - must have at lease 1 upper case letter and 1 upper case number
\A(?=[-_a-zA-Z0-9]*?[A-Z])
(?=[-_a-zA-Z0-9]*?[0-9])
\z
end of a string
\A
begining of the string
phone patter

412-537-5555
(412)-537-5555
%\(?[0-9]{3}\)?-?[0-9]{3}[-. ]?[0-9]{4}%
date pattern
%(0?[1-9]|[12][0-9]|3[01])[- /.](0?[1-9]|[12][0-9]|3[01])[- /.](19|20)?[0-9]{2}%
(?=)
Match what proceeds equals if what follows equals matches
^(Derbylane)
the sentence starts with Derby lane
\s+
unknown number of psaces