Knowee
Questions
Features
Study Tools

Write regular expressions for the following languages.1. the set of all alphabetic strings;2. the set of all lower case alphabetic strings ending in a b;3. the set of all strings from the alphabet a, b such that each a is immedi-ately preceded by and immediately followed by a b

Question

Write regular expressions for the following languages.1. the set of all alphabetic strings;2. the set of all lower case alphabetic strings ending in a b;3. the set of all strings from the alphabet a, b such that each a is immedi-ately preceded by and immediately followed by a b

🧐 Not the exact question you are looking for?Go ask a question

Solution

  1. The regular expression for the set of all alphabetic strings is: [a-zA-Z]+

Explanation:

  • [a-zA-Z] matches any lowercase or uppercase alphabetic character.
    • indicates that the previous character or group should appear one or more times.
  1. The regular expression for the set of all lowercase alphabetic strings ending in a 'b' is: [a-z]*b

Explanation:

  • [a-z] matches any lowercase alphabetic character.
    • indicates that the previous character or group should appear zero or more times.
  • 'b' matches the literal character 'b' at the end of the string.
  1. The regular expression for the set of all strings from the alphabet 'a' and 'b' such that each 'a' is immediately preceded by and immediately followed by a 'b' is: b(ab)*b

Explanation:

  • 'b' matches the literal character 'b'.
  • (ab) matches the sequence of characters 'ab'.
    • indicates that the previous character or group should appear zero or more times.
  • The expression b(ab)*b ensures that each 'a' is surrounded by 'b' characters.

This problem has been solved

Similar Questions

For each of the following languages over the alphabet Σ = {a, b, c} specified by the regular expressions (a)–(c),provide two strings in Σ∗ that are members and two strings in Σ∗ that are not members of the language (fourstrings each).(a) ab + a(b) ((bc)∗ + b)a(c) (a + ab + abc)∗(b + c)

Give the regular set for each of the following regular expressionsi. (10)*10*ii. a*U(bc*)iii. (0 U 1) (0 U 1)*00iv. a(bc)* U (dc)*v. (a U b . c)*vi. a.(b u c)vii. a* . (b u c)viii. (10)*10

Which of the following languages are regular?A = {x | x has two 0’s separated by the number of positions that is a multiple of 4 }.B = {x | x is binary representation of multiple of 3}.C = {x | x is a binary string and decimal of any prefix of x is not of form 3m + 2, where m ≥ 0}.Select one:a. All of the mentioned.b. Only B and C. c. Only A.d. Only B.

Which of the following is a regular language?

Which regular grammar generates the language consisting of strings with zero or more occurrences of "a" followed by "b"?Options :S -> ab | aS | εS -> a | b | aSS -> ab | aSnone

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.