Language & Regular Expressions Flashcards
What is a basic Regex scenario?
What are the different applications of language and regular expression?
- Processing data - sequences or strings
- Pattern matching in databases
- Text searching
- Checking inputs for conformity for compilers and grammar parsing
Example Applications
- Search and replace in text including programs
- Searching in gene/protein sequence databases
What is the basic set notation - Element of…
What is the basic set notation - Not an element of….
What is the basic set notation - (proper) subset of…
What is the basic set notation - Not a (proper) subset of…
What is the basic set notation - Subset and equal to
What is the basic set notation - Proper subset of
What is the basic set notation - Union / ‘OR’
What is the basic set notation - Intersection / ‘AND’
What is the basic set notation - Not A
What is the basic set notation - Empty Set {}
What is the basic set notation - Cardinality (Size) of set A
What are the basic set rules?
What is the theory of formal languages?
- Certain letters form certain sentences which form certain paragraphs which form coherent stories
- Spoken languages are difficult to analyse
- Most universal language structure
- Rules for the lang are explicitly stated
- In terms of what strings of symbols can occur
What are formal languages?
- Alphabet - finite set of fundamental units (symbols, letters and tokens)
- Uses ∑ as the name of alphabet ∑= {a,q,r}
- Language - set of strings of symbols from the alphabet
- As well as specific to the language
- Words - finite strings that are permissible
- In the language which can be generated from the alphabet + rules of lang
- Empty, null string - Epsilon ε or Lambda
How do you descibe abstract languages?
How does concatenation work
How does the length of strings work?
- Length of a string is the number of characters in the string
- length(ε) = 0 in any language that includes ε
How does reversing strings work?
- Function which reverses strings
- Reverse(a) = the same strings and letters in backwards order
- Reverse of a
- Which is valid even if reverse(a) is not a word in the langague
How does generalising the * operator to a set of words work?
- If S = set of words
- S* = the set of finite strings formed by concatenating words
- From S including ε where repetition is allowed
What are regular expressions?
What are the basic regex concepts?
What is regex quantification?
What are some pattern matching applications?
Test if a string matches some pattern
- Process natural language
- Scan for virus signatures
- Search for information on google
Parse Text Files
- Compile a java program
- Crawl + index the web
WHat are the basic regex operations?
What are some generalised regex?