This document provides an overview of regular expressions (regex). It defines regex as patterns that define classes of strings. Regex are used by utilities like grep, sed, awk, vi and emacs to search for patterns in text. The document discusses the syntax of regex like alternation, grouping and quantification. It provides examples of regex patterns and explains how commands like grep can be used with regex to search files.
The document discusses various shell scripting tools including grep, sed, and awk. It provides descriptions and examples of how to use grep to search for patterns in files using regular expressions. It also covers sed for stream editing to find and replace text. Finally, it discusses awk for text processing and programming with actions based on patterns in fields and records.
Regular expressions (regex) allow complex pattern matching in text. The document discusses regex basics like literals, character classes, quantifiers, and flags in Python. It explains how to use the re module to compile patterns into RegexObjects and search/match strings. RegexObjects provide reusable patterns while re module functions provide shortcuts but cache compiled patterns.
This document provides an introduction to regular expressions (RegEx). It explains that RegEx allows you to find, match, compare or replace text patterns. It then discusses the basic building blocks of RegEx, including characters, character classes, quantifiers, and assertions. It provides several examples of RegEx patterns to match names, words, ports numbers, and other patterns. It concludes with an overview of common RegEx match types like beginning/end of line, word boundaries, grouping, alternatives, and repetition.
101 3.7 search text files using regular expressionsAc叩cio Oliveira
油
This document discusses using regular expressions and utilities like grep and sed to search text files. It provides examples of common regular expression metacharacters like *, ., ^, $, [], etc. and describes how grep and sed can be used to search for patterns in files and make substitutions using regular expressions. Key tools discussed are grep, sed, and common options for searching, substituting, and addressing lines when using sed.
101 3.7 search text files using regular expressionsAc叩cio Oliveira
油
This document discusses using regular expressions and utilities like grep and sed to search text files. It provides examples of common regular expression metacharacters like *, ., ^, $, [], etc. and describes how grep and sed can be used to search files using these patterns. Sed can perform search and replace operations on files and streams while grep searches for patterns only.
3.7 search text files using regular expressionsAc叩cio Oliveira
油
The document discusses using regular expressions and utilities like grep and sed to search text files. It provides examples of searching and making substitutions in files using sed syntax like s/regex/replacement/flags. It also covers grep options like -E, -F and -G for different regex types and describes basic regex metacharacters like *, ., ^, $, [], {} for matching patterns.
Regular expressions are patterns used to match strings in programs like sed, awk, grep, and others. They descend from finite automata theory and are used for tasks like searching text files, lexical analysis of programming languages, and early web search engines. In Linux systems, regular expressions are used by commands like sed, grep, and vi. Sed can perform editing operations on lines that match regular expression addresses.
This document provides an overview of regular expressions in Python. It defines regular expressions as sequences of characters used to search for patterns in strings. The re module allows using regular expressions in Python programs. Metacharacters like [], ., ^, $, *, + extend the matching capabilities of regular expressions beyond basic text. Examples demonstrate using re functions like search and special characters to extract lines from files based on patterns.
Regular expressions in Java allow for powerful text manipulation and extraction of parts of strings. A regular expression is a pattern that can match part or all of a string. In Java, a regular expression is compiled into a Pattern object, which is then used to create a Matcher object for a specific string. The Matcher provides methods to find matches and extract matched substrings. Mastering regular expressions requires learning a new "programming language" of punctuation symbols, but they are a useful tool for manipulating text.
grep is a command line utility that searches for patterns in files. It searches the given file(s) for lines containing a match to the given strings or regular expressions and outputs the matching lines. By default, grep prints the matching lines. The name "grep" derives from a similar operation using the Unix/Linux text editor ed. grep uses regular expressions to search for text patterns that can match multiple characters and patterns in text. It has many options to customize searches, such as ignoring case, counting matches, inverting matches, and more.
Chapter 3: Introduction to Regular Expressionazzamhadeel89
油
This document provides an overview of regular expressions and their use. It discusses common regular expression commands like grep and egrep. It explains various regular expression metacharacters such as period, question mark, asterisk, plus, and brackets for character classes. It also covers grouping, back references, quantifiers, anchors and word boundaries. Examples are provided to illustrate how each concept works in matching text patterns.
This document discusses strings in Python. It covers how strings are treated as a contiguous series of characters that can be indexed, sliced, concatenated, appended, and multiplied. It also discusses that strings are immutable in Python. Various string methods and functions are described, including formatting strings using the % operator. The document also covers regular expressions for string pattern matching and manipulation using the re module.
101 3.7 search text files using regular expressionsAc叩cio Oliveira
油
The document provides information about using regular expressions and common Linux utilities like grep and sed to search text files. It covers the basic syntax and options for grep and sed, examples of how to use them to search and make substitutions in files, and an overview of common regular expression metacharacters. The key topics discussed are using grep to search for patterns in files, the s command and flags in sed for substitutions, and metacharacters in regular expressions like *, ., ^, $, [], etc. and what they are used to match in text searches.
Script files, also called M-files, make MATLAB programming more efficient than entering individual commands. M-files are text files that contain MATLAB commands to perform specific tasks. They can be created and edited in any plain text editor or the built-in MATLAB editor. User defined functions are a special type of M-file that take inputs and produce outputs, with the function name and arguments specified in the first line. Strings in MATLAB are matrices of character elements that can be manipulated using various functions like converting between data types and extracting substrings.
Script files, also called M-files, make MATLAB programming more efficient than entering individual commands. M-files are text files that contain MATLAB commands to perform specific tasks. They can be created and edited in any plain text editor or the built-in MATLAB editor. User defined functions are a special type of M-file that take inputs and produce outputs, with the function name and arguments specified in the first line. Strings in MATLAB are matrices of character elements that can be manipulated using various functions like converting between data types and extracting substrings.
The document discusses various concepts related to strings in C programming language. It defines fixed length and variable length strings. For variable length strings, it explains length controlled and delimited strings. It describes how strings are stored and manipulated in C using character arrays terminated by a null character. The document also summarizes various string manipulation functions like string length, copy, compare, concatenate etc available in C standard library.
Generic programming allows writing algorithms that operate on many data types. It avoids duplicating code for each specific type. Generic methods can accept type parameters, allowing a single method to work on different types. Generic classes can also take type parameters, making it possible to define concepts like stacks independently of the element type. Type safety is ensured through type parameters that specify what types are allowed.
This document discusses regular languages and finite automata. It begins with an overview of regular expressions and the introduction to the theory of finite automata. It then explains that finite automata are used in text processing, compilers, and hardware design. The document goes on to define automata theory and discusses deterministic finite automata (DFA) and nondeterministic finite automata (NFA). It notes that while NFA allow epsilon transitions and multiple state transitions, DFA and NFA have equivalent computational power.
This document provides an overview of various Linux utilities for examining files, manipulating text, performing calculations, sorting data, and more. It summarizes the purpose and basic usage of utilities like wc, cat, more, grep, sort, uniq, cut, paste and others. Key functions covered include viewing file contents, searching/filtering text, mathematical operations, ordering lines, and identifying duplicate lines.
This document provides an overview of character arrays and strings in C programming. It discusses declaring and initializing string variables as character arrays, reading strings from the terminal using scanf() and gets() functions, and copying one string to another. The key points covered are:
- Strings are represented using character arrays in C with a null terminator.
- scanf() with %s reads strings until a whitespace, gets() reads a full line.
- A for loop can be used to copy one string to another character by character.
C programming & data structure [character strings & string functions]MomenMostafa
油
The document provides information about C programming language and data structures. It includes references to books and websites on the topics. The document outlines topics that will be covered, including arrays and pointers, strings and string functions, structures, algorithms, stacks, queues and trees. It then gives details on a lesson about string functions, including examples of gets(), puts(), fgets() and other standard library string functions.
This document discusses strings in C programming. It defines strings as arrays of characters that end with a null terminator (\0). It explains how to initialize and print strings. Common string functions like strlen(), strcpy(), strcat(), and strcmp() are described. The document contrasts strings and character pointers, noting strings cannot be reassigned while pointers can. Finally, it lists and briefly explains other standard string library functions.
This lecture discusses the concept of Regular Expressions along with its usage in different tools such as grep, sed, and awk
Check the other Lectures and courses in
http://Linux4EnbeddedSystems.com
or Follow our Facebook Group at
- Facebook: @LinuxforEmbeddedSystems
Lecturer Profile:
- https://www.linkedin.com/in/ahmedelarabawy
This document discusses regular expressions (regexes) in Perl programming. It provides three examples that demonstrate extracting date values from a string using different regex techniques. It then discusses some key regex concepts like quantifiers, grouping, anchors, character classes and more. Code examples are provided to illustrate each concept. The goal is to help readers better understand how to leverage the powerful regex engine in Perl to perform complex text matching and manipulation tasks.
This document provides 15 examples of using the Linux grep command to search files for text patterns. Some key examples include searching for a string in single or multiple files, ignoring case, using regular expressions to match patterns, displaying lines before/after/around matches, inverting matches, counting matches, and highlighting matched text. The examples demonstrate many useful grep options for finding text in files.
We need to layer the technology onto existing workflows
Follow the teachers who inspire you because that instills passion Curiosity & Lifelong Learning.
You can benefit from generative AI even when its intelligence is worse-because of the potential for cost and time savings in low-cost-of-error environments.
Bot tutors are already yielding effective results on learning and mastery.
GenAI may increase the digital divide- its gains may accrue disproportionately to those who already have domain expertise.
GenAI can be used for Coding
Complex structures
Make the content
Manage the content
Solutions to complex numerical problems
Lesson plan
Assignment
Quiz
Question bank
Report & summary of content
Creating videos
Title of abstract & summaries and much more like...
Improving Grant Writing
Learning by Teaching Chatbots
GenAI as peer Learner
Data Analysis for Non-Coders
Student Course Preparation
To reduce Plagiarism
Legal Problems for classes
Understanding Student Learning in Real Time
Simulate a poor
Faculty co-pilot chatbot
Generate fresh Assessments
Data Analysis Partner
Summarize student questions in real-time
Assess depth of students' understanding
The skills to foster are Listening
Communicating
Approaching the problem & solving
Making Real Time Decisions
Logic
Refining Memories
Learning Cultures & Syntax (Foreign Language)
Chatbots & Agentic AI can never so what a professor can do.
The need of the hour is to teach Creativity
Emotions
Judgement
Psychology
Communication
Human Emotions
Through various content!
Marketing is Everything in the Beauty Business! 憓 Talent gets you in the ...coreylewis960
油
Marketing is Everything in the Beauty Business! 憓
Talent gets you in the gamebut visibility keeps your chair full.
Todays top stylists arent just skilledtheyre seen.
Thats where MyFi Beauty comes in.
We Help You Get Noticed with Tools That Work:
Social Media Scheduling & Strategy
We make it easy for you to stay consistent and on-brand across Instagram, Facebook, TikTok, and more.
Youll get content prompts, captions, and posting tools that do the work while you do the hair.
ワ Your Own Personal Beauty App
Stand out from the crowd with a custom app made just for you. Clients can:
Book appointments
Browse your services
View your gallery
Join your email/text list
Leave reviews & refer friends
種 Offline Marketing Made Easy
We provide digital flyers, QR codes, and branded business cards that connect straight to your appturning strangers into loyal clients with just one tap.
ッ The Result?
You build a strong personal brand that reaches more people, books more clients, and grows with you. Whether youre just starting out or trying to level upMyFi Beauty is your silent partner in success.
More Related Content
Similar to Lecture 18 - Regular Expressions.pdf (20)
This document provides an overview of regular expressions in Python. It defines regular expressions as sequences of characters used to search for patterns in strings. The re module allows using regular expressions in Python programs. Metacharacters like [], ., ^, $, *, + extend the matching capabilities of regular expressions beyond basic text. Examples demonstrate using re functions like search and special characters to extract lines from files based on patterns.
Regular expressions in Java allow for powerful text manipulation and extraction of parts of strings. A regular expression is a pattern that can match part or all of a string. In Java, a regular expression is compiled into a Pattern object, which is then used to create a Matcher object for a specific string. The Matcher provides methods to find matches and extract matched substrings. Mastering regular expressions requires learning a new "programming language" of punctuation symbols, but they are a useful tool for manipulating text.
grep is a command line utility that searches for patterns in files. It searches the given file(s) for lines containing a match to the given strings or regular expressions and outputs the matching lines. By default, grep prints the matching lines. The name "grep" derives from a similar operation using the Unix/Linux text editor ed. grep uses regular expressions to search for text patterns that can match multiple characters and patterns in text. It has many options to customize searches, such as ignoring case, counting matches, inverting matches, and more.
Chapter 3: Introduction to Regular Expressionazzamhadeel89
油
This document provides an overview of regular expressions and their use. It discusses common regular expression commands like grep and egrep. It explains various regular expression metacharacters such as period, question mark, asterisk, plus, and brackets for character classes. It also covers grouping, back references, quantifiers, anchors and word boundaries. Examples are provided to illustrate how each concept works in matching text patterns.
This document discusses strings in Python. It covers how strings are treated as a contiguous series of characters that can be indexed, sliced, concatenated, appended, and multiplied. It also discusses that strings are immutable in Python. Various string methods and functions are described, including formatting strings using the % operator. The document also covers regular expressions for string pattern matching and manipulation using the re module.
101 3.7 search text files using regular expressionsAc叩cio Oliveira
油
The document provides information about using regular expressions and common Linux utilities like grep and sed to search text files. It covers the basic syntax and options for grep and sed, examples of how to use them to search and make substitutions in files, and an overview of common regular expression metacharacters. The key topics discussed are using grep to search for patterns in files, the s command and flags in sed for substitutions, and metacharacters in regular expressions like *, ., ^, $, [], etc. and what they are used to match in text searches.
Script files, also called M-files, make MATLAB programming more efficient than entering individual commands. M-files are text files that contain MATLAB commands to perform specific tasks. They can be created and edited in any plain text editor or the built-in MATLAB editor. User defined functions are a special type of M-file that take inputs and produce outputs, with the function name and arguments specified in the first line. Strings in MATLAB are matrices of character elements that can be manipulated using various functions like converting between data types and extracting substrings.
Script files, also called M-files, make MATLAB programming more efficient than entering individual commands. M-files are text files that contain MATLAB commands to perform specific tasks. They can be created and edited in any plain text editor or the built-in MATLAB editor. User defined functions are a special type of M-file that take inputs and produce outputs, with the function name and arguments specified in the first line. Strings in MATLAB are matrices of character elements that can be manipulated using various functions like converting between data types and extracting substrings.
The document discusses various concepts related to strings in C programming language. It defines fixed length and variable length strings. For variable length strings, it explains length controlled and delimited strings. It describes how strings are stored and manipulated in C using character arrays terminated by a null character. The document also summarizes various string manipulation functions like string length, copy, compare, concatenate etc available in C standard library.
Generic programming allows writing algorithms that operate on many data types. It avoids duplicating code for each specific type. Generic methods can accept type parameters, allowing a single method to work on different types. Generic classes can also take type parameters, making it possible to define concepts like stacks independently of the element type. Type safety is ensured through type parameters that specify what types are allowed.
This document discusses regular languages and finite automata. It begins with an overview of regular expressions and the introduction to the theory of finite automata. It then explains that finite automata are used in text processing, compilers, and hardware design. The document goes on to define automata theory and discusses deterministic finite automata (DFA) and nondeterministic finite automata (NFA). It notes that while NFA allow epsilon transitions and multiple state transitions, DFA and NFA have equivalent computational power.
This document provides an overview of various Linux utilities for examining files, manipulating text, performing calculations, sorting data, and more. It summarizes the purpose and basic usage of utilities like wc, cat, more, grep, sort, uniq, cut, paste and others. Key functions covered include viewing file contents, searching/filtering text, mathematical operations, ordering lines, and identifying duplicate lines.
This document provides an overview of character arrays and strings in C programming. It discusses declaring and initializing string variables as character arrays, reading strings from the terminal using scanf() and gets() functions, and copying one string to another. The key points covered are:
- Strings are represented using character arrays in C with a null terminator.
- scanf() with %s reads strings until a whitespace, gets() reads a full line.
- A for loop can be used to copy one string to another character by character.
C programming & data structure [character strings & string functions]MomenMostafa
油
The document provides information about C programming language and data structures. It includes references to books and websites on the topics. The document outlines topics that will be covered, including arrays and pointers, strings and string functions, structures, algorithms, stacks, queues and trees. It then gives details on a lesson about string functions, including examples of gets(), puts(), fgets() and other standard library string functions.
This document discusses strings in C programming. It defines strings as arrays of characters that end with a null terminator (\0). It explains how to initialize and print strings. Common string functions like strlen(), strcpy(), strcat(), and strcmp() are described. The document contrasts strings and character pointers, noting strings cannot be reassigned while pointers can. Finally, it lists and briefly explains other standard string library functions.
This lecture discusses the concept of Regular Expressions along with its usage in different tools such as grep, sed, and awk
Check the other Lectures and courses in
http://Linux4EnbeddedSystems.com
or Follow our Facebook Group at
- Facebook: @LinuxforEmbeddedSystems
Lecturer Profile:
- https://www.linkedin.com/in/ahmedelarabawy
This document discusses regular expressions (regexes) in Perl programming. It provides three examples that demonstrate extracting date values from a string using different regex techniques. It then discusses some key regex concepts like quantifiers, grouping, anchors, character classes and more. Code examples are provided to illustrate each concept. The goal is to help readers better understand how to leverage the powerful regex engine in Perl to perform complex text matching and manipulation tasks.
This document provides 15 examples of using the Linux grep command to search files for text patterns. Some key examples include searching for a string in single or multiple files, ignoring case, using regular expressions to match patterns, displaying lines before/after/around matches, inverting matches, counting matches, and highlighting matched text. The examples demonstrate many useful grep options for finding text in files.
We need to layer the technology onto existing workflows
Follow the teachers who inspire you because that instills passion Curiosity & Lifelong Learning.
You can benefit from generative AI even when its intelligence is worse-because of the potential for cost and time savings in low-cost-of-error environments.
Bot tutors are already yielding effective results on learning and mastery.
GenAI may increase the digital divide- its gains may accrue disproportionately to those who already have domain expertise.
GenAI can be used for Coding
Complex structures
Make the content
Manage the content
Solutions to complex numerical problems
Lesson plan
Assignment
Quiz
Question bank
Report & summary of content
Creating videos
Title of abstract & summaries and much more like...
Improving Grant Writing
Learning by Teaching Chatbots
GenAI as peer Learner
Data Analysis for Non-Coders
Student Course Preparation
To reduce Plagiarism
Legal Problems for classes
Understanding Student Learning in Real Time
Simulate a poor
Faculty co-pilot chatbot
Generate fresh Assessments
Data Analysis Partner
Summarize student questions in real-time
Assess depth of students' understanding
The skills to foster are Listening
Communicating
Approaching the problem & solving
Making Real Time Decisions
Logic
Refining Memories
Learning Cultures & Syntax (Foreign Language)
Chatbots & Agentic AI can never so what a professor can do.
The need of the hour is to teach Creativity
Emotions
Judgement
Psychology
Communication
Human Emotions
Through various content!
Marketing is Everything in the Beauty Business! 憓 Talent gets you in the ...coreylewis960
油
Marketing is Everything in the Beauty Business! 憓
Talent gets you in the gamebut visibility keeps your chair full.
Todays top stylists arent just skilledtheyre seen.
Thats where MyFi Beauty comes in.
We Help You Get Noticed with Tools That Work:
Social Media Scheduling & Strategy
We make it easy for you to stay consistent and on-brand across Instagram, Facebook, TikTok, and more.
Youll get content prompts, captions, and posting tools that do the work while you do the hair.
ワ Your Own Personal Beauty App
Stand out from the crowd with a custom app made just for you. Clients can:
Book appointments
Browse your services
View your gallery
Join your email/text list
Leave reviews & refer friends
種 Offline Marketing Made Easy
We provide digital flyers, QR codes, and branded business cards that connect straight to your appturning strangers into loyal clients with just one tap.
ッ The Result?
You build a strong personal brand that reaches more people, books more clients, and grows with you. Whether youre just starting out or trying to level upMyFi Beauty is your silent partner in success.
Anorectal malformations refer to a range of congenital anomalies that involve the anus, rectum, and sometimes the urinary and genital organs. They result from abnormal development during the embryonic stage, leading to incomplete or absent formation of the rectum, anus, or both.
General Quiz at ChakraView 2025 | Amlan Sarkar | Ashoka Univeristy | Prelims ...Amlan Sarkar
油
Prelims (with answers) + Finals of a general quiz originally conducted on 9th February, 2025.
This was the closing quiz of the 2025 edition of ChakraView - the annual quiz fest of Ashoka University.
Feedback welcome at amlansarkr@gmail.com
Enhancing SoTL through Generative AI -- Opportunities and Ethical Considerati...Sue Beckingham
油
This presentation explores the role of generative AI (GenAI) in enhancing the Scholarship of Teaching and Learning (SoTL), using Feltens five principles of good practice as a guiding framework. As educators within higher education institutions increasingly integrate GenAI into teaching and research, it is vital to consider how these tools can support scholarly inquiry into student learning, while remaining contextually grounded, methodologically rigorous, collaborative, and appropriately public.
Through practical examples and case-based scenarios, the session demonstrates how generative GenAI can assist in analysing critical reflection of current practice, enhancing teaching approaches and learning materials, supporting SoTL research design, fostering student partnerships, and amplifying the reach of scholarly outputs. Attendees will gain insights into ethical considerations, opportunities, and limitations of GenAI in SoTL, as well as ideas for integrating GenAI tools into their own scholarly teaching practices. The session invites critical reflection and dialogue about the responsible use of GenAI to enhance teaching, learning, and scholarly impact.
General College Quiz conducted by Pragya the Official Quiz Club of the University of Engineering and Management Kolkata in collaboration with Ecstasia the official cultural fest of the University of Engineering and Management Kolkata.
Chapter 6. Business and Corporate Strategy Formulation.pdfRommel Regala
油
This integrative course examines the strategic decision-making processes of top management,
focusing on the formulation, implementation, and evaluation of corporate strategies and policies.
Students will develop critical thinking and analytical skills by applying strategic frameworks,
conducting industry and environmental analyses, and exploring competitive positioning. Key
topics include corporate governance, business ethics, competitive advantage, and strategy
execution. Through case studies and real-world applications, students will gain a holistic
understanding of strategic management and its role in organizational success, preparing them to
navigate complex business environments and drive strategic initiatives effectively.
Unit No 4- Chemotherapy of Malignancy.pptxAshish Umale
油
In the Pharmacy profession there are many dangerous diseases from which the most dangerous is cancer. Here we study about the cancer as well as its treatment that is supportive to the students of semester VI of Bachelor of Pharmacy. Cancer is a disease of cells of characterized by Progressive, Persistent, Perverted (abnormal), Purposeless and uncontrolled Proliferation of tissues. There are many types of cancer that are harmful to the human body which are responsible to cause the disease condition. The position 7 of guanine residues in DNA is especially susceptible. Cyclophosphamide is a prodrug converted to the active metabolite aldophosphamide in the liver. Procarbazine is a weak MAO inhibitor; produces sedation and other CNS effects, and can interact with foods and drugs. Methotrexate is one of the most commonly used anticancer drugs. Methotrexate (MTX) is a folic acid antagonist. 6-MP and 6-TG are activated to their ribonucleotides, which inhibit purine ring biosynthesis and nucleotide inter conversion. Pyrimidine analogue used in antineoplastic, antifungal and anti psoriatic agents.
5-Fluorouracil (5-FU) is a pyrimidine analog. It is a complex diterpin taxane obtained from bark of the Western yew tree. Actinomycin D is obtained from the fungus of Streptomyces species. Gefitinib and Erlotinib inhibit epidermal growth factor receptor (EGFR) tyrosine kinase. Sunitinib inhibits multiple receptor tyrosine kinases like platelet derived growth factor (PDGF) Rituximab target antigen on the B cells causing lysis of these cells.
Prednisolone is 4 times more potent than hydrocortisone, also more selective glucocorticoid, but fluid retention does occur with high doses. Estradiol is a major regulator of growth for the subset of breast cancers that express the estrogen receptor (ER, ESR1).
Finasteride and dutasteride inhibit conversion of testosterone to dihydrotestosterone in prostate (and other tissues), have palliative effect in advanced carcinoma prostate; occasionally used. Chemotherapy in most cancers (except curable cancers) is generally palliative and suppressive. Chemotherapy is just one of the modes in the treatment of cancer. Other modes like radiotherapy and surgery are also employed to ensure 'total cell kill'.
Team Science in the AI Era: Talk for the Association of Cancer Center Administrators (ACCA) Team Science Network (April 2, 2025, 3pm ET)
Host: Jill Slack-Davis (https://www.linkedin.com/in/jill-slack-davis-56024514/)
20250402 Team Science in the AI Era
These slides: TBD
Jim Twin V1 (English video - Heygen) - https://youtu.be/T4S0uZp1SHw
Jim Twin V1 (French video - Heygen) - https://youtu.be/02hCGRJnCoc
Jim Twin (Chat) Tmpt.me Platform https://tmpt.app/@jimtwin
Jim Twin (English video OpenSource) https://youtu.be/mwnZjTNegXE
Jim Blog Post - https://service-science.info/archives/6612
Jim EIT Article (Real Jim) - https://www.eitdigital.eu/newsroom/grow-digital-insights/personal-ai-digital-twins-the-future-of-human-interaction/
Jim EIT Talk (Real Jim) - https://youtu.be/_1X6bRfOqc4
Reid Hoffman (English video) - https://youtu.be/rgD2gmwCS10
Viceroys of India & Their Tenure Key Events During British RuleDeeptiKumari61
油
The British Raj in India (1857-1947) saw significant events under various Viceroys, shaping the political, economic, and social landscape.
**Early Period (1856-1888):**
Lord Canning (1856-1862) handled the Revolt of 1857, leading to the British Crown taking direct control. Universities were established, and the Indian Councils Act (1861) was passed. Lord Lawrence (1864-1869) led the Bhutan War and established High Courts. Lord Lytton (1876-1880) enforced repressive laws like the Vernacular Press Act (1878) and Arms Act (1878) while waging the Second Afghan War.
**Reforms & Political Awakening (1880-1905):**
Lord Ripon (1880-1884) introduced the Factory Act (1881), Local Self-Government Resolution (1882), and repealed the Vernacular Press Act. Lord Dufferin (1884-1888) oversaw the formation of the Indian National Congress (1885). Lord Lansdowne (1888-1894) passed the Factory Act (1891) and Indian Councils Act (1892). Lord Curzon (1899-1905) introduced educational reforms but faced backlash for the Partition of Bengal (1905).
**Rise of Nationalism (1905-1931):**
Lord Minto II (1905-1910) saw the rise of the Swadeshi Movement and the Muslim League's formation (1906). Lord Hardinge II (1910-1916) annulled Bengals Partition (1911) and shifted Indias capital to Delhi. Lord Chelmsford (1916-1921) faced the Lucknow Pact (1916), Jallianwala Bagh Massacre (1919), and Non-Cooperation Movement. Lord Reading (1921-1926) dealt with the Chauri Chaura Incident (1922) and the formation of the Swaraj Party. Lord Irwin (1926-1931) saw the Simon Commission protests, the Dandi March, and the Gandhi-Irwin Pact (1931).
**Towards Independence (1931-1947):**
Lord Willingdon (1931-1936) introduced the Government of India Act (1935), laying India's federal framework. Lord Linlithgow (1936-1944) faced WWII-related crises, including the Quit India Movement (1942). Lord Wavell (1944-1947) proposed the Cabinet Mission Plan (1946) and negotiated British withdrawal. Lord Mountbatten (1947-1948) oversaw India's Partition and Independence on August 15, 1947.
**Final Transition:**
C. Rajagopalachari (1948-1950), Indias last Governor-General, facilitated Indias transition into a republic before the position was abolished in 1950.
The British Viceroys played a crucial role in Indias colonial history, introducing both repressive and progressive policies that fueled nationalist movements, ultimately leading to independence.https://www.youtube.com/@DKDEducation
compiler design BCS613C question bank 2022 schemeSuvarna Hiremath
油
Lecture 18 - Regular Expressions.pdf
1. Copyright @ 2009 Ananda Gunawardena
Lecture 18
Regular Expressions
Many of todays web applications require matching patterns in a text document to look
for specific information. A good example is parsing a html file to extract <img> tags of a
web document. If the image locations are available, then we can write a script to
automatically download these images to a location we specify. Looking for tags like
<img> is a form of searching for a pattern. Pattern searches are widely used in many
applications like search engines. A regular expression(regex) is defined as a pattern
that defines a class of strings. Given a string, we can then test if the string belongs to this
class of patterns. Regular expressions are used by many of the unix utilities like grep,
sed, awk, vi, emacs etc. We will learn the syntax of describing regex later.
Pattern search is a useful activity and can be used in many applications. We are already
doing some level of pattern search when we use wildcards such as *. For example,
> ls *.c
Lists all the files with c extension or
ls ab*
lists all file names that starts with ab in the current directory. These type of commands
(ls,dir etc) work with windows, unix and most operating systems. That is, the command ls
will look for files with a certain name patterns but are limited in ways we can describe
patterns. The wild card (*) is typically used with many commands in unix. For example,
cp *.c /afs/andrew.cmu.edu/course/15/123/handin/Lab6/guna
copies all .c files in the current directory to the given directory
Unix commands like ls, cp can use simple wild card (*) type syntax to describe specific
patterns and perform the corresponding tasks. However, there are many powerful unix
utilities that can look for patterns described in general purpose notations. One such utility
is the grep command.
The grep command
Grep command is a unix tools that can be used for pattern matching. Its description is
given by the following.
2. Copyright @ 2009 Ananda Gunawardena
.
The grep (Global Regular Expression Print) is a unix command utility that can be used to
find specific patterns described in regular expressions, a notation which we will learn
shortly. For example, the grep command can be used to match all lines containing a
specific pattern. For example,
grep a href guna.html output.txt
writes all lines containing the matching substring a href to the file output.txt
grep unix command can be an extremely handy tool for searching for patterns. If we do
grep foo filename
it returns all lines of the file given by filename that matches string foo.
Unix provide the | command (pipe command) to send an input from one process to
another process. Say for example, we would like to find all files that have the pattern
guna. We can do the following to accomplish that task.
ls | grep guna
We note again that Pipe command | is used to send the output from one command as
input to another. For example, in the above command, we are sending the output from ls
as input to grep command.
If we need to find a pattern a.c in a file name (that is any file name that has the substring
a.c, where dot(.) indicates that any single character can be substituted) we can give the
command
ls | grep a.c
So we can find file name that has the substring aac, abc, a_c etc.
grep
NAME
grep, egrep, fgrep - print lines matching a pattern
SYNOPSIS
grep [options] PATTERN [FILE...]
grep [options] [-e PATTERN | -f FILE] [FILE...]
DESCRIPTION
grep searches the named input FILEs (or standard input if no files are
named, or the file name - is given) for lines containing a match to
the given PATTERN. By default, grep prints the matching lines.
Source: unix manual
3. Copyright @ 2009 Ananda Gunawardena
Text Processing Languages
There are many scripting languages that can be used to process textual data to extract and
manipulate patterns of interest. Among some of the popular languages are awk, sed and
perl. In this course, we will not go in detail into awk and sed, but will encourage students
to read and understand some of the use cases of these utilities as a general topic of
interest. We will however, later focus on perl, a popular programming language for
parsing textual data. Before we learn perl programming, we will focus on learning regular
expressions, a powerful way to describe general string patterns in perl. With the
understanding of regular expressions and perl syntax, we can write powerful programs to
accomplish interesting tasks.
Regular expressions
Regular expressions, that defines a pattern in a string, are used by many programs such
as grep, sed, awk, vi, emacs etc. The PERL language (which we will discuss soon) is a
scripting language where regular expressions can be used extensively for pattern
matching.
The origin of the regular expressions can be traced back to formal language theory or
automata theory, both of which are part of theoretical computer science.
A formal language consists of an alphabet, say {a,b,c} and a set of strings defined by the
language. For example, a language defined on the alphabet {a,b,c} could be all strings
that has at least one a. So ababb and abcbbc etc are valid strings while ccb is not.
An automaton (or automata in plural) is a machine that can recognize valid strings
generated by a formal language. A finite automata is a mathematical model of a finite
state machine (FSM), an abstract model under which all modern computers are built. A
FSM is a machine that consists of a set of finite states and a transition table. The FSM
can be in any one of the states and can transit from one state to another based on a series
of rules given by a transition function.
Example: think about a FSM that has an alphabet {a,b} and 3 states, Q0, Q1, and Q2
Define Q0 as the initial state, Q1 as intermediate and Q2 as the final or accepting state.
Complete the transitions so that the machine accepts any string that begins with zero or
more as immediately followed by one or more bs and then ending with an a. So the
strings accepted by this FSM would include aba, aaba, ba, aaaaaabbbbbbbbba
etc.
Q0 Q1 Q2
4. Copyright @ 2009 Ananda Gunawardena
Finite automata can be built to recognize valid strings defined by a formal language. For
example, we can use a machine as defined above to find all substrings that begins with
zero or more as immediately followed by one or more bs and then ending with an a.
One important feature of a finite state machine is that it cannot be used to count. That is,
FSMs have no memory. For example, we can build a machine to accept all strings that
has even number of as, but cannot build a FSM to count the as in the string.
Our discussion on FSMs now leads to regular expressions. A regular expressions and
FSMs are equivalent concepts. Regular expression is a pattern that can be recognized by
a FSM.
Regular Expression Grammar
Regular expression grammar defines the notation used to describe a regular expression.
We discuss here the basic concepts of regular expression grammar including
alternation, grouping and quantification. It should be noted that these grammar may
not work exactly as is in every system. The grammar defined here are applicable to strong
regex based languages such as perl.
Alternation
The vertical bar is used to describe alternating choices among two or more choices. For
example, the notation a | b | c indicates that we can choose a or b or c as part of the string.
Another example is that (c|s)at describes the expressions cat or sat.
Grouping
Parenthesis can be used to describe the scope and precedence of operators. In the
example above (c|s) indicates that we can either begin with c or s but must immediately
follow by at.
Quantification
Quantification is the notation used to define the number of symbols that could appear in
the string. The most common quantifiers are ?, * and +
The ? mark indicates that there is zero or one of the previous expression. For example
aab?b would represents the strings aab and aabb etc. Color and Colour can be
described by the regex Colou?r.
The * indicates that zero or more of the previous expression can be accepted. For
example: a(ab)*b indicates any string that begins with a, ends with a b, but can have
any number of the substring ab in the middle. The strings ab, aabb, aababb are
all valid strings described by the regex a(ab)*b.
The + indicates at least one of the previous expression. For example
go+gle would describe the expressions gogle , google , gooogle etc.
5. Copyright @ 2009 Ananda Gunawardena
Other Facts
. matches a single character
.* matches any string
[a-zA-Z]* matches any string of alphabetic characters
[ag].* matches any string that starts with a or g
[a-d].* matches any string that starts with a,b,c or d
^ab matches any string that begins with ab. In general, to match all lines that
begins with any string use ^string
grep command used with regular expression notation can make a powerful scripting
language. When using grep, be sure to escape special characters with .
Eg: grep b(a | c ) b looks for patterns bab or bcb specifically
Example
1. Find all subdirectories within a directory
Answer: ls l | grep ^d
Character Classes
Character classes such as digits (0-9) can be described using a short hand syntax such as
d. A PERL(a language we shortly learn) programmer is free to use either [0-9] or d to
describe a character class.
d digit [0-9]
D non-digit [^0-9]
w word character [0-9a-z_A-Z]
W non-word character [^0-9a-z_A-Z]
s a whitespace character [ tnrf]
S a non-whitespace character [^ tnrf]
Note: we will not use these shorthand notations with grep
Other more general regex grammar includes
1. {n,m} at least n but not more than m times
2. {n,} match at least n times
3. {n} match exactly n times
Examples:
Find all patterns that has at least one but no more than 3, as
(ans: grep a{1,3} filename)
Finding non-matches
To exclude patterns we can use [^class]. For example, to exclude patterns that may
contain a numeric digit, write [^0-9]. For example, we can exclude all lines that begins
with a-z by writing
grep ^[^a-z] filename
6. Copyright @ 2009 Ananda Gunawardena
Group Matching
If we group a match by using ( ) then the matching groups are given by 1, 2 etc..
For example a regex
h([1-4]).*h([1-3])
Returns 1 as the number that matched with the first group ([1-4]) and
2 as the number that matched with the second group ([1-3])
This can be useful in looking for patterns based on previous patterns found. For example
The regex
h[1-4] can match to h1, h2, h3, or h4.
Suppose later in the expression we need to match the same index. We can do this by
grouping [1-4] as ([1-4]) --- note we need ( to make sure that ( is not used as a literal
match ---
Now the match is saved in a variable 1 (must refer to as 1) it can be used later in the
expression to match similar indices. An application of this would be to look for
h1 . h1 but not h1 . h2
Here is how you do that.
grep h([1-4]).*h1 filename
In general, the back-reference n, where n is a single digit, matches the substring
previously matched by the nth parenthesized sub expression of the regular expression.
This concept is sometimes called back reference. We will expand these ideas later in
Perl programming.
Summarized Facts about regex
Two regular expressions may be concatenated; the resulting regular expression
matches any string formed by concatenating two substrings that respectively
match the concatenated subexpressions.
Two regular expressions may be joined by the infix operator | the resulting
regular expression matches any string matching either subexpression.
Repetition takes precedence over concatenation, which in turn takes precedence
over alternation. A whole subexpression may be enclosed in parentheses to
override these precedence rules.
The backreference n, where n is a single digit, matches the substring previously
matched by the nth parenthesized subexpression of the regular expression.
7. Copyright @ 2009 Ananda Gunawardena
In basic regular expressions the metacharacters ?, +, {, |, (, and ) lose their
special meaning; instead use the backslashed versions ?, +, {, |, (, and ).
Source: Unix Manual
Exercises
1. Build a FSM that can accept any string that has even number of as. Assume the
alphabet is {a,b}.
2. Using grep command and regular expressions, list all files in the default directory
that others can read or write
3. Write a regex that matches the emails of the form userid@domain.edu. Where
userid is one of more word characters or + and the domain is one or more word
characters.
4. Construct a FSM and a regular expression that matches patterns
containing at least one ab followed by any number of bs.
5. Write the grep commands for each of the following tasks
a. Find all patterns that matches the pattern ted or
fred
b. Find all patterns that matches ed, ted or fed
c. Find all patterns that does not begin with g
d. Find all patterns that begins with g or any digit from
0-9
e. Find all patterns that begins with guna
f. Find lines in a file where the pattern sam occurs at
least twice
g. Find all lines in a file that contain email addresses
6. Write a regex that matches any number between 1000 and 9999
7. Write a regex that matches any number between 100 and 9999
8. Write a regex that lists all the files in the current directory
that was created in Nov and are txt files.
8. Copyright @ 2009 Ananda Gunawardena
ANSWERS
1. Build a FSM that can accept any string that has even number of as. Assume the
alphabet is {a,b}.
2. Using grep command and regular expressions, list all files in the default directory
that others can read or write
Ans: ls l | grep .{7}rw
3. Write a regex that matches the emails of the form userid@domain.edu. Where
userid is one of more alpha characters or + and the domain is one or more alpha
characters.
Ans: grep [a-z+]+@[a-z]+.edu
4. Construct a FSM and a regular expression that matches patterns
containing at least one ab followed by any number of bs.
Ans: grep (ab)+b*
5. Write the grep commands for each of the following tasks
a. Find all patterns that matches the pattern ted or
fred [t/fr]ed
b. Find all patterns that matches ed, ted or fed
[t|f]?ed
c. Find all patterns that does not begin with g
^[^g]
d. Find all patterns that begins with g or any digit from
0-9
^(g|[0-9])
e. Find all patterns that begins with guna
^(guna)
f. Find lines in a file where the pattern sam occurs at
least twice
(sam).*1
g. Find all lines in a html file that contain email
addresses (hint: mailto)
6. Write a regex that matches any number between 1000 and 9999
Ans: [1-9][0-9]{3}