QUESTION 1 Indicate the proper regular expression to: \"Find all complete lines
ID: 3842661 • Letter: Q
Question
QUESTION 1
Indicate the proper regular expression to: "Find all complete lines of a file which contain nothing but one ore more occurrences of the letter Z"
^ZZZZZ$
^Z+$
^Z*$
Z*
1 points
QUESTION 2
Indicate the proper regular expression to: "Find all complete lines of a file which contain a row consisting only the letter x but ignoring any leading or trailing space on the line"
^s(x*)s$
^s+x+s+$
^s*x+s*$
s*x+s*
1 points
QUESTION 3
Which regular expression, when applied to complete sentences, would match complete words that begin and end with the same letter, and only begin and end. (For example "algebra" matches but "amoebae" does not.)
(w)w+()
(w)w+(w)
^www$
s.*s
1 points
QUESTION 4
Every language supporting regular expressions uses the same standardized syntax.
True
False
1 points
QUESTION 5
All three of the languages we studied in the course of the semester have both Regular Expression processing capabilities either "built-in to" the language or have Regular expression processing available in a standard language library.
True
False
1 points
QUESTION 6
XML would be best categorized as a "High Level Programming Language"
True
False
1 points
QUESTION 7
The most common technology used to find/locate elements in an XML file is:
JavaScript
XSLT
HTML
XPATH
1 points
QUESTION 8
The core technology used to transform an XML document into HTML document is:
JavaScript
XSLT
XPATH
HTML
1 points
QUESTION 9
One of the benefits of XML is that when using the technology to transmit information from from a server to a client, the client does not have to understand anything about the meaning of the document in order verify and validate the document's correctness.
True
False
1 points
QUESTION 10
All three of the languages we studied in the course of the semester have both Regular Expression and XML processing capabilities either "built-in" to the language or available as an language library.
True
False
1 points
QUESTION 11
A programmer must use Regular Expressions when writing code to process an XML document.
True
False
1 points
QUESTION 12
Write a Regular Expression (just the expression) that will match against any valid "dotted" IP4 address. For simplicity, consider the address as valid if it is in the following form:
A.B.C.D where A, B, C, and D are any numbers between 0 and 255.
Examples of valid addresses (at least valid for our purposes):
0.0.0.0
255.255.255.255
192.168.0.1
(Note that some some of these examples are not actually valid IP addresses due to more complicated numbering rules, but we're just looking at the basic structure here!)
Examples of invalid addresses (these are all truly invalid):
300.0.0.0
27.34
1.2.3.555
Hint: you may want to consider the case of a 3 digit number differently than a 1 or two digit number.
Path: p
Words:0
5 points
QUESTION 13
Using the basic "Perl Syntax", write a single "regular expression" (not a whole program) that would replace all occurrences of numbers in the form 1234567890 (any 10 consecutive digits, but only 10) in a file with the same digits in the following format: (123) 456-7890
Path: p
Words:0
3 points
QUESTION 14
YOU MAY USE EITHER PERL OR PYTHON FOR THIS QUESTION.
For this question: Download the list of words here: https://tigerweb.towson.edu/aconover/small_dictionary.txt
Write a single Perl or Python program to count and display the number of occurrences of words which contain 4 consecutive vowels. (Vowels include a,e,i,o,u,y). The input should be readable from a "input pipe" (as in <cat or type> somefile.txt | <perl or python> program_name). Note that the input just has one word on each line:
Fake Example input:
abcdef
aeiou
zaeyiax
abecixoxu
(The bolded letters are shown here only for illustration.)
Example Output:
aeiou
zaeyiax
Found 2 matches
(Just paste your solution into the answer field. If using Python, please make sure the formatting is correct.)
Path: p
Words:0
5 points
QUESTION 15
Using regular expressions, write a complete Perl script that, when given the input from a sample as shown below, displays ONLY the valid phone numbers found anywhere in the file. For this example assume a phone number is valid only if it is in the following form (where 9 represents any number):
(999)-999-9999
Sample Input:
this is a test
12345676867
(123)-456-7890
My number: (123)-555-1212
test 9999 test.
A phone number ((123)-999-0000) exists on this line.
There is no phone number ((123)-999+0000) on this line.
Sample Output:
(123)-456-7890
(123)-555-1212
(123)-999-0000
Path: p
Words:0
5 points
QUESTION 16
Question:
And one just to tie everything together: This is one where you might have to look at some documentation and utilize what you've learned to solve a slightly different problem.
Given the HTML "Starter Document" linked below, complete the "checkFieldX()" functions to validate the user input as indicated. In other words, verify that the user entered text matches the given pattern. You only need to complete/submit this set of functions, not the whole HTML document.
You should use at least one regular expression somewhere in the process validation process, but you may also use whatever other techniques you feel comfortable with.
Save the contents of this link to your machine and view it: https://tigerweb.towson.edu/aconover/itec345/Simple_Validation.html
^ZZZZZ$
^Z+$
^Z*$
Z*
MashupsExplanation / Answer
Question 1:
Correct regular expression for all Z string is : ^Z+$
Here ^ implies start of line, Z+ implies one or more occurance of Z and $ implies end of line.
Question 2:
Correct regular expression for a line with x and spaces is: ^s*x+s*$
Here s* implies zero or more leading and trailing spaces.
Question 3:
Required regular expression is: (w)w+()
implies word boundary, (w) implies group of search pattern for word character(A-Z or a-z or 0-9), w+ implies one or more characters and () implies reference to first group of search pattern.
Question 4:
False
One of the oldest sets of standardized regular expressions are the POSIX BRE (basic regular expressions) and ERE (extended regular expressions). Other languages may define their own standards.
Question 5:
Not sure about the three languages studied.
Question 6:
False.
XML. In computing, Extensible Markup Language (XML) is a markup language that defines a set of rules for encoding documents in a format that is both human-readable and machine-readable.
Question 7:
XPATH.
XPath is a syntax for defining parts of an XML document. XPath uses path expressions to navigate in XML documents.
Question 8:
XSLT are used to convert xml to HTML.
Question 9:
True.
Question 10 is same Question 5. Not sure of three subjects.
Question 11:
False.
A programmer can search for a tag directly by using xpath as well.
Question 12:
Required regular expression:
^([01]?dd?|2[0-4]d|25[0-5]).([01]?dd?|2[0-4]d|25[0-5]).([01]?dd?|2[0-4]d|25[0-5]).([01]?dd?|2[0-4]d|25[0-5])$
^ implies start of line and $ implies end of line. ([01]?dd?|2[0-4]d|25[0-5]) implies digit from 0 to 255 followed by a dot.
([01]?dd?|2[0-4]d|25[0-5]) implies three options, first one is a number starting with 0 or 1 followed by 1 or 2 digit.
Second, starting with 2 then second digit between 0 to 4 and followed by a digit. Third, 25 followed by a digit between 0 to 5.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.