Question
Regular Expression Homework Write a regular expression that will match any word that beginsand ends with a capital letter. (For example MooN matches, SUNDAYS matches,
Regular Expression Homework
Write a regular expression that will match any word that beginsand ends with a capital letter. (For exampleMooN matches, SUNDAYS matches,hello does not match, CSC126 doesnot match)
Write a regular expression that begins with a digit, ends with adigit and has 3 to 5 characters (any, except digits) between thetwo digits. We did not cover negation but the ^ inside acharacter class means negation. So [^abc] matches anything EXCEPTan a b or c.
(We will cover on Monday!) Write a regular expression thatbegins and ends with the SAME capital letter. SoSUNDAYS matches but MooN doesnot!!
Write a regular expression that will match (from beginning toend) the full words in the positive list but will not match (atall!) the words in the negative list:
POSITIVE LIST | NEGATIVE LIST |
voted | tried |
toddle | true |
teddy | trundle |
patted | tea |
|
|
Write a regular expression that matches a CSI email address. Theemail address has the users firstname, then a period, the userslast name, the @ symbol and then either cix.csi.cuny.edu orcsi.cuny.edu
sarah.zelikovitz@csi.cuny.edu matches
sar.zel1@cix.csi.cuny.edu matches (sometimes two people have thesame name so numbers are added)
s.zelikovitz@(g)mail.com does not match (not a csi email)
s.zelikovitz@csi.cuny.edu matches (it is fine to have a oneletter first name!)
sarah.zelikovitz@rutgers.edu does not match (not a csiemail)
szelikovitz@cix.csi.cuny.edu does not match (nofirstname.lastname)
Copy and paste your php script and give a url so that I can tryit out! Given a string that has text with two dates in Aprilsomewhere in the text. For example, the text might be
$textLine = "Both dates are in April! April 2,".
" 1996 and April 12, 2009";
Use preg_match to print out the month, day and year on separatelines:
April
2
1996
April
12
2009
Extra credit: Use other string functions to do the same as thepreg_match code above!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started