MORE APPLICATIONS OF REGULAR EXPRESSION By Venkata Sai Pundamalli id:

Slides:



Advertisements
Similar presentations
CSCI3170 Introduction to Database Systems
Advertisements

Computer Science & Engineering 2111 Text Functions 1CSE 2111 Lecture-Text Functions.
CS 497C – Introduction to UNIX Lecture 31: - Filters Using Regular Expressions – grep and sed Chin-Chih Chang
Introduction to Structured Query Language (SQL)
30-Jun-15 SQL A Brief Introduction. SQL SQL is Structured Query Language Some people pronounce SQL as “sequel” Other people insist that only “ess-cue-ell”
Introduction to Structured Query Language (SQL)
Regular Expressions 101 Danny Bryant City of Atlanta.
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
. If the PHP server is an server or is aware of which server is the server, then one can write code that s information. –For example,
Slide 6a-1 CHAPTER 6 Matching Patterns: Using Regular expressions to match patterns.
Regular Expressions in ColdFusion Applications Dave Fauth DOMAIN technologies Knowledge Engineering : Systems Integration : Web.
Last Updated March 2006 Slide 1 Regular Expressions.
1 Chapter 6 – Creating Web Forms and Validating User Input spring into PHP 5 by Steven Holzner Slides were developed by Jack Davis College of Information.
ASP.NET Programming with C# and SQL Server First Edition
Regular Expressions Dr. Ralph D. Westfall May, 2011.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 7 INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) Instructor Ms. Arwa.
Chapter 10 Selected Single-Row Functions Oracle 10g: SQL.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Working with MSSQL Server Code:G0-C# Version: 1.0 Author: Pham Trung Hai CTD.
CIS 451: Regular Expressions Dr. Ralph D. Westfall January, 2009.
RegExp. Regular Expression A regular expression is a certain way to describe a pattern of characters. Pattern-matching or keyword search. Regular expressions.
Lecture # 3 Regular Expressions 1. Introduction In computing, a regular expression provides a concise and flexible means to "match" (specify and recognize)
8 Copyright © 2006, Oracle. All rights reserved. Regular Expression Support.
Internet Information Systems Writing to Databases and Amending Data.
7 1 Chapter 7 Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
Yet more on XSLT. Regular expression handling in EXSLT We saw that the EXSLT extensions are divided into a group of modules, each of which has its own.
Oracle 11g: SQL Chapter 10 Selected Single-Row Functions.
6 1 Lecture 8: Introduction to Structured Query Language (SQL) J. S. Chou, P.E., Ph.D.
What is PHP? PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are executed on the server PHP supports.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 24 The String Section.
Chungbuk HRDI of KCCI PhD Kang,Won-Chan PHP Programming (Regular Expressions)
PHP| SCK3633 Web Programming | Jumail, FSKSM, UTM, 2006 | Last Updated March 2006 Slide 1 Regular Expressions.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 7 Introduction to Structured Query Language (SQL)
REGEX. Problems Have big text file, want to extract data – Phone numbers (503)
12. Regular Expressions. 2 Motto: I don't play accurately-any one can play accurately- but I play with wonderful expression. As far as the piano is concerned,
GREP. Whats Grep? Grep is a popular unix program that supports a special programming language for doing regular expressions The grammar in use for software.
Advanced SQL: Triggers & Assertions
PHP’s Regular Expression Functions (Perl Compatible) Examples taken from: Beginning PHP 5 and MySQL 5 From Novice to Professional.
20-753: Fundamentals of Web Programming 1 Lecture 10: Server-Side Scripting II Fundamentals of Web Programming Lecture 10: Server-Side Scripting II.
Visual Programing SQL Overview Section 1.
SQL John Nowobilski. What is SQL? Structured Query Language Manages Data in Database Management Systems based on the Relational Model Developed in 1970s.
Powerpoint Templates Page 1 Powerpoint Templates GROUP 8:REGULAR EXPRESSION GURU BESAR: PN. SARINA SULAIMAN CIKGU-CIKGU: 1.CIKGU NENI 2.CIKGU
Programming with Microsoft Visual Basic 2008 Fourth Edition Chapter Eight String Manipulation.
1 Lecture 9 Shell Programming – Command substitution Regular expressions and grep Use of exit, for loop and expr commands COP 3353 Introduction to UNIX.
Working with Columns, Characters, and Rows. 2 home back first prev next last What Will I Learn? In this lesson, you will learn to: –Apply the concatenation.
Validation using Regular Expressions. Regular Expression Instead of asking if user input has some particular value, sometimes you want to know if it follows.
Unit 11 –Reglar Expressions Instructor: Brent Presley.
Copyright © 2003 Pearson Education, Inc. Slide 6a-1 The Web Wizard’s Guide to PHP by David Lash.
7 Copyright © 2009, Oracle. All rights reserved. Regular Expression Support.
Programming with Microsoft Visual Basic 2008 Fourth Edition Chapter Eight String Manipulation.
CS 111 – Nov. 8 Databases Database Management Systems (DBMS) Structured Query Language (SQL) Commitment –Please review sections 9.1 – 9.2.
INT222 – Internet Fundamentals Week 11: RegExp Object and HTML5 Form Validation 1.
IST 210 More SQL Todd Bacastow IST 210: Organization of Data.
An Introduction to Regular Expressions Specifying a Pattern that a String must meet.
8 1 String Manipulation CGI/Perl Programming By Diane Zak.
Chapter 23 The String Section (String Manipulation) Clearly Visual Basic: Programming with Visual Basic nd Edition.
SQL: Structured Query Language It enables to create and operate on relational databases, which are sets of related information stored in tables. It is.
LM 5 Introduction to SQL MISM 4135 Instructor: Dr. Lei Li.
Dr. Chen, Oracle Database System (Oracle) 1 Basic Nested Queries and Views Jason C. H. Chen, Ph.D. Professor of MIS School of Business Gonzaga University.
Marketing Analytics: Database Query with MySQL Disclaimer: All logos, photos, etc. used in this presentation are the property of their respective copyright.
PHP LANGUAGE MULTIPLE CHOICE QUESTION SET-5
Logical Functions Excel Lesson 10.
CS 330 Class 7 Comments on Exam Programming plan for today:
Introducing Oracle Regular Expressions
Chapter 10 Selected Single-Row Functions Oracle 10g: SQL
Lecture 9 Shell Programming – Command substitution
Chapter 19 PHP Part II Credits: Parts of the slides are based on slides created by textbook authors, P.J. Deitel and H. M. Deitel by Prentice Hall ©
Restricting and Sorting Data
CIS16 Application Development and Programming using Visual Basic.net
PHP PART 2.
How to cheat at Scrabble An intro to regular expressions
Presentation transcript:

MORE APPLICATIONS OF REGULAR EXPRESSION By Venkata Sai Pundamalli id:

CONTENTS  Introduction to Regular Expression  Regular Expressions used in  Applications of Regular Expression a.RE in PHP b.RE in Databases c.RE in Voice Recognition

Regular Expression A regular expression is an algebraic formula whose value is a pattern consisting of a set of strings. Example: The set of strings over {A-Z,a-z} that contain the word “main” = A | B | ……. | Z | a | b | ……. | z * main * Here, * may or may not contain any combination of strings over {A- Z,a-z} * = { ε, a, b, aa, bb, ab, bc, ez, abc, main, part, …. }

Regular Expressions used in APPLICATIONSLANGUAGES Apache HTTP Server.NET Microsoft Visual StudioC++ NetbeansD Notepad++Java LibreOffice CalcJavaScript Oracle DatabasePerl PythonPHP Sublime TextRuby

a. Regular Expression in PHP  The ereg() function searches a string to match the given pattern, returning true if the pattern is found, and false otherwise. The search is case sensitive  The eregi() function searches a string to match the given pattern, returning true if the pattern is found, and false otherwise. The search is not case sensitive. Applications of Regular Expression

Difference between ereg and eregi: <?php $string = 'XYZ'; if (ereg('z', $string)) { echo "'$string' contains a 'z'"; } else { echo "'$string' contains a 'Z'!"; } ?> OUTPUT 'XYZ' contains a 'Z'! <?php $string = 'XYZ'; if (eregi('z', $string)) { echo "'$string' contains a 'z‘ or ‘Z’"; } else { echo "'$string' contains a 'Z'!"; } ?> OUTPUT 'XYZ' contains a ‘z‘ or ‘Z’!

<?php $string = "abcd"; $string1 = ereg("^a",$string); if($string1==1) echo "TRUE"; else echo "FALSE"; ?> <?php $string = "abcd"; $string1 = ereg("bc$",$string); if($string1==1) echo "TRUE"; else echo "FALSE"; ?> Output: TRUE Output: FALSE Examples of ereg in PHP:

<?php $string = "this is sample \nwhich is also sample"; echo $string; echo "\nAfter Replacement ::\n"; $string = ereg_replace("\n", "", $string); echo $string; ?> Output: this is sample which is also sample After Replacement :: this is sample which is also sample <?php $string = "this is sample"; $string = ereg_replace("^", " ", $string); echo $string; ?> Output: this is sample Contd.,

b. Regular Expression in Databases Oracle Database implementation of Regular Expressions SQL ElementDescription REGEXP_LIKEIt’s a condition used to match the given pattern REGEXP_COUNTIt’s a function which returns number of times the given pattern appears in the given string REGEXP_REPLACEIt’s a function which searches for a pattern in a character column and replace each occurrence of that pattern with the specified string

For instance, To ensure that phone numbers are entered into the database in a standard format. (XXX) XXX-XXXX DROP TABLE contacts; CREATE TABLE contacts ( l_name VARCHAR2(30), p_number VARCHAR2(30) CONSTRAINT c_contacts_pnf CHECK ( REGEXP_LIKE (p_number, '^\(\d{3}\) \d{3}-\d{4}$')) ); INSERT INTO contacts (p_number) VALUES('(650) ');

The following example examines the given string. Oracle returns the number of times that the word ‘the’ appears in the sting. SELECT REGEXP_COUNT ('The example shows how to use the REGEXP_COUNT function.', 'the', 1, 'i') ”REGEXP_COUNT” FROM dual; REGEXP_COUNT

The following example examines country_name. Oracle puts a space after each non-null character in the string. SELECT REGEXP_REPLACE (country_name, '(.)', '\1 ') "REGEXP_REPLACE" FROM countries; REGEXP_REPLACE A r g e n t i n a A u s t r a l i a B e l g i u m B r a z i l C a n a d a

For each name in the table whose format is "first middle last", we reposition the characters so that the format becomes "last, first middle": SELECT names "names", REGEXP_REPLACE (names, '^(\S+)\s(\S+)\s(\S+)$', '\3, \1 \2') AS "names after regexp" FROM famous_people ORDER BY "names"; names names after regexp Harry S. Truman Truman, Harry S. John Quincy Adams Adams, John Quincy John Adams John Quincy Adams John Quincy Adams John_Quincy_Adams

c. Regular Expression in voice recognition  A Speech recognition application is capable of launching external applications based on the command we tell to it.  Regular Expression used in this application is: string command = Regex.Replace(line, "Start", "").Trim();  This application is written in C# with the help of Visual Studio Express.

References:    #ADFNS00402  #CHDJAGEF   recognition-using-c-part-2/

Thank You Any Queries???