Ad
Monday, October 2, 2023
Theoretical computer science for Internal Exam (TYBCS) (SEM 5)
Chapter 1: Finite Automaton
Chapter 2: Regular Expressions
Literals: Characters that match themselves. For example, the regular expression
a
matches the character 'a'.Concatenation: Concatenation of characters or sub-expressions. For example,
abc
matches the string 'abc'.Alternation (|): The pipe symbol '|' represents alternation and is used to specify alternatives. For example,
a|b
matches either 'a' or 'b'.Kleene Star (*): The asterisk '*' denotes zero or more occurrences of the preceding element. For example,
a*
matches zero or more 'a' characters.Kleene Plus (+): The plus symbol '+' denotes one or more occurrences of the preceding element. For example,
a+
matches one or more 'a' characters.Grouping ( ): Parentheses are used to group sub-expressions. For example,
(ab|cd)*
matches zero or more repetitions of 'ab' or 'cd'.Character Classes [ ]: Square brackets are used to define a character class, which matches any single character from the set. For example,
[aeiou]
matches any vowel.Ranges (-): Inside character classes, you can use a hyphen '-' to specify a range of characters. For example,
[0-9]
matches any digit.Wildcard (.): The dot '.' matches any single character except a newline.
Escape (): The backslash '' is used to escape special characters, allowing you to match them literally. For example,
\.
matches a period '.'Anchors (^ and $): The caret '^' represents the start of a line, and the dollar sign '$' represents the end of a line. For example,
^abc$
matches the entire string 'abc'.Quantifiers (?, {n}, {n,}, {n,m}): Quantifiers specify the exact number of occurrences. For example,
a{3}
matches exactly three 'a' characters, andb{2,4}
matches between two and four 'b' characters.
Q. Regular Expressions - Definition & Examples.
Answer:
Normal Definition: The language accepted by finite automata are described or represented by simple expressions called Regular Expressions. It is a sequence of characters that defines a search pattern. It is used for matching strings with a set of strings.They are also called as rational expressions.
Formal Definition: 2.1.1
Examples: 2.1.2
Q.
About Abhishek Dhamdhere
Qna Library Is a Free Online Library of questions and answers where we want to provide all the solutions to problems that students are facing in their studies. Right now we are serving students from maharashtra state board by providing notes or exercise solutions for various academic subjects
No comments:
Post a Comment