Question

Write a regular expression in C for * A Shake is an ampersand '&' or a...

Write a regular expression in C for

* A Shake is an ampersand '&' or a plus '+' or a '/' followed by

    an even number of letters 'a' through 'z' followed by an

    ampersand '&' or a plus '+' or a '/' BUT IT CANNOT END WITH

    THE SAME CHARACTER WITH WHICH IT STARTED. That is, if it

  begins with '&', it must end with '+' or '/', and so forth.

    (FYI: "an even number" means 0 or 2 or 4 or 6 or ..., which

     can also be stated as 2n, where n >= 0.)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

ANSWER

&([a-z][a-z])*(\+|\/)|\+([a-z][a-z])*(&|\/)|\/([a-z][a-z])*(\+|&)

EXPLANATION

Any of the below 3

  1. &([a-z][a-z])*(\+|\/)
  2. \+([a-z][a-z])*(&|\/)
  3. \/([a-z][a-z])*(\+|&)

([a-z][a-z])* is to get even # of letters 'a' through 'z'

Add a comment
Know the answer?
Add Answer to:
Write a regular expression in C for * A Shake is an ampersand '&' or a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT