Define a regular expression in JAVA for the following
An "Ent" is an at sign '@',...
Define a regular expression in JAVA for the following
An "Ent" is an at sign '@', followed by one or more
decimal
digits '0' through '9' or uppercase letters 'R' through 'W',
followed by an octothorpe sign '#'
create a regular expression in Java that defines the
following.
A "Stir" is a right brace '}' followed by zero or more
lowercase letters 'a' through 'z' and decimal digits '0'
through '9', followed by a left parenthesis '('.
: Create a Java program that will accept a regular expression
and a filename for a text file. The program will process the file,
looking at every line to find matches for the regular expression
and display them.
Regular Expression Format : The following operators need to be
accepted:
+ - one or more of the following character (no groups)
* - zero or more of the following character (no groups)
[] – no negation, no character spans – the...
Unix / Linux
16.
Regular Expression:
Given the following regular expression, provide a description of
the intended match.
^[^A-Z]
17.
Regular Expression:
Given the following regular expression, provide a description of
the intended match.
[^^!]
18.
Regular Expression:
Given the following regular expression, provide a description of
the intended match.
^.\{72\}$
19.
Regular Expression:
Given the following regular expression, provide a description of
the intended match.
[A-Za-z0-9]
20.
Regular Expression:
Given the following regular expression, provide a description of
the...
Consider the following regular expression meta operators:
( ) [ ] { } . * + ? ^ $ | \
For each of the following, give one example of strings which the
regular expression would match.
Describe (colloquially, in a manner that a non-technical person
would understand) the set of strings that the pattern is designed
to match.
Each regular expression is enclosed in the pair of '/'
characters below.
[2 marks each]
(a) /^[a-z][0-9]*\.$/
(b) /([0-9]+)\s\w+\s\1/
Write a JAVA program that reads a text file into RAM efficiently,
takes a regular expression from the user, and then prints every
line that matches the RE.
If you would define a rule for creating a variable in C using
regular expression, how would you write it?
If you need to skip statements in for or
while loops and go to the next iteration, what
statement will you use?
In respect to users and processes, how would you define Linux
OS?
Regular Expressions Assignment
Write a regular expression for each of the following. Can you
show output please.
A blank line (may contain spaces)
Postal abbreviation (2 letters) for State followed by a space
and then the 5-digit zip code
A KU student username (Ex. lpork247)
A “valid” email address (also explain how you defined
“valid”)
A SSN pattern (ddd-dd-dddd)
FOR JAVA
Define a class QuadraticExpression that represents the quadratic expression ax^2 + bx + c:
You should provide the following methods
(1) default constructor which initalizes all the coefficients to 0
(2) a constructor that takes three parameters
public QuadraticExpression(double a, double b, double c)
(3) a toString() method that returns the expression as a string.
(4) evaluate method that returns the value of the expression at x
public double evaluate(double x)
(5) set method of a, b, c...
submit a regular expression that will identify each of the
following patterns.
1 - a US telephone number that conforms to the following pattern
111.222.3456
2 - a US social security number that fits the following pattern
111-22-3456
3 - an American Express credit card number that fits the
following format:
4 digits followed by a space
followed by 6 digits followed by a space followed by 5 digits
False positives are allowed in each case, so all you need...
Formal Languages
Give a regular expression for each of the following
languages:
L2a = {w ? {0,1}* | w corresponds to the binary encoding of
non-negative integers that are evenly divisible by 4
L2b = {w ? {a,b}* | w contains at least one 'a' and exactly two
b's}
L2c = {w ? {0, 1, 2}* | w starts with a 2, ends with a 1 and
contains an even number of 0's}.