Lex is a computer program that generates lexical analyzers and was written by Mike Lesk and Eric Schmidt.
Lex reads an input stream specifying the lexical analyzer and outputs source code implementing the lexer in the C programming language.
Prerequisite: Flex (Fast lexical Analyzer Generator)
The extraction is based on the way tags are written in HTML. All tags are included in < >. This will set the rule to extract the HTML tags from the given input file.
Input File: tags.txt
Below is the implementation to extract HTML tags from file:
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Lex code to replace a word with another word in a file
- C program to copy contents of one file to another file
- Lex program to copy the content of one file to another file
- Self Destructing Code in C
- Basic Code Optimizations in C
- Writing OS Independent Code in C/C++
- Speed up Code executions with help of Pragma in C/C++
- Code valid in both C and C++ but produce different output
- DFA in LEX code which accepts strings ending with 11
- Convert C/C++ program to Preprocessor code
- How to write a running C code without main()?
- Convert C/C++ code to assembly language
- Printing source code of a C program itself
- Code to generate the map of India (with explanation)
- C++: Methods of code shortening in competitive programming
- Lex code to count total number of tokens
- What is data type of FILE in C ?
- C | File Handling | Question 5
- C | File Handling | Question 1
- C | File Handling | Question 2
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : nidhi_biet