ADVERTISEMENT
ADVERTISEMENT

Home » Compiler Design

LEX Code to extract all html tags in the given HTML file at run time and store into Text file given

In this article, we are going to learn how to create LEX program to extract all HTML tag from HTML file?
Submitted by Ashish Varshney, on March 25, 2018

For achieve to this task we create some rules in rule section in the code.

%{
#include<stdio.h>
%}

%%
\<[^>]*\> fprintf(yyout,"%s\n",yytext);
.|\n; 
%%

int yywrap()
{
return 1;
}

int main()
{
yyin=fopen("input7.html","r");
yyout=fopen("output7.txt","w");
yylex();
return 0;
}

Input

LEX Code to extract all html tags in the given HTML file at run time and store into Text file given - Incput

Output

LEX Code to extract all html tags in the given HTML file at run time and store into Text file given - Output

ADVERTISEMENT



ADVERTISEMENT



Comments and Discussions


ADVERTISEMENT

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.