SlideShare une entreprise Scribd logo
1  sur  18
Regular Expression Support
Objectives ,[object Object]
Regular Expression Overview ABC A method of describing both simple and complex patterns for searching and manipulating Several new functions to support regular expressions A multilingual regular expression support for SQL and PLSQL string types
Meta Characters Specifies equivalence classes ,[object Object],Matches one or more occurrence ,[object Object],Matches zero or one occurrence ,[object Object],Matches any character in the supported character set, except NULL ,[object Object],Grouping expression, treated as a single subexpression ,[object Object],Back-reference expression ,[object Object],Specifies a character class and matches any character in that class ,[object Object],Can have 4 different meanings: 1. Stand for itself. 2. Quote the next character. 3. Introduce an operator. 4. Do nothing. ,[object Object],Description ,[object Object],Specifies one collation element, such as a multicharacter element Matches at least  m  times but no more than  n  times Matches exactly  m  times Bracket expression for a matching list matching any one of the expressions represented in the list Matches the start-of-line/end-of-line Alteration operator for specifying alternative matches Matches zero or more occurrences ,[object Object],[object Object],[object Object],[object Object],^/$ ,[object Object],[object Object]
Using Meta Characters Problem: Find 'abc' within a string: Solution:  'abc' Matches:  abc Does not match:  'def' Problem: To find 'a' followed by any character, followed  by 'c' Meta Character:  any  character is defined by '.' Solution:  'a.c' Matches:  abc Matches:  adc Matches:  alc Matches:  a&c Does not match:  abb Problem: To find one or more occurrences of 'a'  Meta Character: Use'+' sign to match one or more of the previous characters Solution:  'a+' Matches:  a Matches:  aa Does not match:  bbb 1 2 3
Notes Only
Regular Expression Functions Searches for a given string for a regular expression pattern and returns the position where the match is found REGEXP_INSTR Searches for a regular expression pattern within a given string and returns the matched substring REGEXP_SUBSTR Searches for a regular expression pattern and replaces it with a replacement string REGEXP_REPLACE Similar to the  LIKE  operator, but performs regular expression matching instead of simple pattern matching REGEXP_LIKE Description Function Name
The  REGEXP  Function Syntax REGEXP_LIKE  (srcstr, pattern [,match_option]) REGEXP_INSTR  (srcstr, pattern [, position [, occurrence [, return_option [, match_option]]]])  REGEXP_SUBSTR (srcstr, pattern [, position  [, occurrence [, match_option]]]) REGEXP_REPLACE(srcstr, pattern [,replacestr [, position  [, occurrence [, match_option]]]])
Performing Basic Searches SELECT first_name, last_name FROM employees WHERE REGEXP_LIKE (first_name, '^Ste(v|ph)en$');
Checking the Presence of a Pattern SELECT street_address,  REGEXP_INSTR(street_address,'[^[:alpha:]]') FROM  locations  WHERE  REGEXP_INSTR(street_address,'[^[:alpha:]]')> 1;
Example of Extracting Substrings SELECT REGEXP_SUBSTR(street_address , ' [^ ]+ ') "Road" FROM locations; …
Replacing Patterns SELECT REGEXP_REPLACE( country_name, '(.)',    ' ') "REGEXP_REPLACE"  FROM countries;  …
Regular Expressions and  Check Constraints ALTER TABLE emp8  ADD CONSTRAINT email_addr  CHECK(REGEXP_LIKE(email,'@'))NOVALIDATE ; INSERT INTO emp8 VALUES  (500,'Christian','Patel',    'ChrisP2creme.com', 1234567890,  '12-Jan-2004', 'HR_REP', 2000, null, 102, 40) ; 1 2
Summary ,[object Object]
Practice 8: Overview ,[object Object]
 
 
 

Contenu connexe

Tendances

Php String And Regular Expressions
Php String  And Regular ExpressionsPhp String  And Regular Expressions
Php String And Regular Expressionsmussawir20
 
Regular Expressions 2007
Regular Expressions 2007Regular Expressions 2007
Regular Expressions 2007Geoffrey Dunn
 
Processing Regex Python
Processing Regex PythonProcessing Regex Python
Processing Regex Pythonprimeteacher32
 
The Power of Regular Expression: use in notepad++
The Power of Regular Expression: use in notepad++The Power of Regular Expression: use in notepad++
The Power of Regular Expression: use in notepad++Anjesh Tuladhar
 
Python advanced 2. regular expression in python
Python advanced 2. regular expression in pythonPython advanced 2. regular expression in python
Python advanced 2. regular expression in pythonJohn(Qiang) Zhang
 
Textpad and Regular Expressions
Textpad and Regular ExpressionsTextpad and Regular Expressions
Textpad and Regular ExpressionsOCSI
 
Regular expressions and php
Regular expressions and phpRegular expressions and php
Regular expressions and phpDavid Stockton
 
Bioinformatica 06-10-2011-p2 introduction
Bioinformatica 06-10-2011-p2 introductionBioinformatica 06-10-2011-p2 introduction
Bioinformatica 06-10-2011-p2 introductionProf. Wim Van Criekinge
 
Regular expressions in Python
Regular expressions in PythonRegular expressions in Python
Regular expressions in PythonSujith Kumar
 
Regular expressions in Perl
Regular expressions in PerlRegular expressions in Perl
Regular expressions in PerlGirish Manwani
 
Regular expressions in Ruby and Introduction to Vim
Regular expressions in Ruby and Introduction to VimRegular expressions in Ruby and Introduction to Vim
Regular expressions in Ruby and Introduction to VimStalin Thangaraj
 
Regular Expression in Action
Regular Expression in ActionRegular Expression in Action
Regular Expression in ActionFolio3 Software
 
Data Structures in Python
Data Structures in PythonData Structures in Python
Data Structures in PythonDevashish Kumar
 
Strings,patterns and regular expressions in perl
Strings,patterns and regular expressions in perlStrings,patterns and regular expressions in perl
Strings,patterns and regular expressions in perlsana mateen
 

Tendances (20)

Php String And Regular Expressions
Php String  And Regular ExpressionsPhp String  And Regular Expressions
Php String And Regular Expressions
 
Regular Expressions 2007
Regular Expressions 2007Regular Expressions 2007
Regular Expressions 2007
 
Processing Regex Python
Processing Regex PythonProcessing Regex Python
Processing Regex Python
 
The Power of Regular Expression: use in notepad++
The Power of Regular Expression: use in notepad++The Power of Regular Expression: use in notepad++
The Power of Regular Expression: use in notepad++
 
Python advanced 2. regular expression in python
Python advanced 2. regular expression in pythonPython advanced 2. regular expression in python
Python advanced 2. regular expression in python
 
Andrei's Regex Clinic
Andrei's Regex ClinicAndrei's Regex Clinic
Andrei's Regex Clinic
 
Adv. python regular expression by Rj
Adv. python regular expression by RjAdv. python regular expression by Rj
Adv. python regular expression by Rj
 
Textpad and Regular Expressions
Textpad and Regular ExpressionsTextpad and Regular Expressions
Textpad and Regular Expressions
 
2.regular expressions
2.regular expressions2.regular expressions
2.regular expressions
 
Regular expressions and php
Regular expressions and phpRegular expressions and php
Regular expressions and php
 
Bioinformatica 06-10-2011-p2 introduction
Bioinformatica 06-10-2011-p2 introductionBioinformatica 06-10-2011-p2 introduction
Bioinformatica 06-10-2011-p2 introduction
 
Regular expressions in Python
Regular expressions in PythonRegular expressions in Python
Regular expressions in Python
 
Regular expressions in Perl
Regular expressions in PerlRegular expressions in Perl
Regular expressions in Perl
 
Python strings
Python stringsPython strings
Python strings
 
Regular expressions in Ruby and Introduction to Vim
Regular expressions in Ruby and Introduction to VimRegular expressions in Ruby and Introduction to Vim
Regular expressions in Ruby and Introduction to Vim
 
Regular Expression in Action
Regular Expression in ActionRegular Expression in Action
Regular Expression in Action
 
Regex lecture
Regex lectureRegex lecture
Regex lecture
 
Data Structures in Python
Data Structures in PythonData Structures in Python
Data Structures in Python
 
2013 - Andrei Zmievski: Clínica Regex
2013 - Andrei Zmievski: Clínica Regex2013 - Andrei Zmievski: Clínica Regex
2013 - Andrei Zmievski: Clínica Regex
 
Strings,patterns and regular expressions in perl
Strings,patterns and regular expressions in perlStrings,patterns and regular expressions in perl
Strings,patterns and regular expressions in perl
 

Similaire à Les08

Regular Expressions 101 Introduction to Regular Expressions
Regular Expressions 101 Introduction to Regular ExpressionsRegular Expressions 101 Introduction to Regular Expressions
Regular Expressions 101 Introduction to Regular ExpressionsDanny Bryant
 
SQL for pattern matching (Oracle 12c)
SQL for pattern matching (Oracle 12c)SQL for pattern matching (Oracle 12c)
SQL for pattern matching (Oracle 12c)Logan Palanisamy
 
Regular expressions
Regular expressionsRegular expressions
Regular expressionsRaj Gupta
 
Python - Regular Expressions
Python - Regular ExpressionsPython - Regular Expressions
Python - Regular ExpressionsMukesh Tekwani
 
Java căn bản - Chapter9
Java căn bản - Chapter9Java căn bản - Chapter9
Java căn bản - Chapter9Vince Vo
 
Introduction To Regex in Lasso 8.5
Introduction To Regex in Lasso 8.5Introduction To Regex in Lasso 8.5
Introduction To Regex in Lasso 8.5bilcorry
 
Looking for Patterns
Looking for PatternsLooking for Patterns
Looking for PatternsKeith Wright
 
Chapter 9 - Characters and Strings
Chapter 9 - Characters and StringsChapter 9 - Characters and Strings
Chapter 9 - Characters and StringsEduardo Bergavera
 
Python regular expressions
Python regular expressionsPython regular expressions
Python regular expressionsKrishna Nanda
 
regular-expression.pdf
regular-expression.pdfregular-expression.pdf
regular-expression.pdfDarellMuchoko
 
Regex startup
Regex startupRegex startup
Regex startupPayPal
 
JavaScript - Chapter 9 - TypeConversion and Regular Expressions
 JavaScript - Chapter 9 - TypeConversion and Regular Expressions  JavaScript - Chapter 9 - TypeConversion and Regular Expressions
JavaScript - Chapter 9 - TypeConversion and Regular Expressions WebStackAcademy
 
Regular expressions
Regular expressionsRegular expressions
Regular expressionsRaghu nath
 
regex.pptx
regex.pptxregex.pptx
regex.pptxqnuslv
 
Maxbox starter20
Maxbox starter20Maxbox starter20
Maxbox starter20Max Kleiner
 
DEE 431 Introduction to MySql Slide 6
DEE 431 Introduction to MySql Slide 6DEE 431 Introduction to MySql Slide 6
DEE 431 Introduction to MySql Slide 6YOGESH SINGH
 

Similaire à Les08 (20)

Regular Expressions 101 Introduction to Regular Expressions
Regular Expressions 101 Introduction to Regular ExpressionsRegular Expressions 101 Introduction to Regular Expressions
Regular Expressions 101 Introduction to Regular Expressions
 
SQL for pattern matching (Oracle 12c)
SQL for pattern matching (Oracle 12c)SQL for pattern matching (Oracle 12c)
SQL for pattern matching (Oracle 12c)
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
Regular Expressions
Regular ExpressionsRegular Expressions
Regular Expressions
 
Python - Regular Expressions
Python - Regular ExpressionsPython - Regular Expressions
Python - Regular Expressions
 
Regex Basics
Regex BasicsRegex Basics
Regex Basics
 
Java căn bản - Chapter9
Java căn bản - Chapter9Java căn bản - Chapter9
Java căn bản - Chapter9
 
Introduction To Regex in Lasso 8.5
Introduction To Regex in Lasso 8.5Introduction To Regex in Lasso 8.5
Introduction To Regex in Lasso 8.5
 
Looking for Patterns
Looking for PatternsLooking for Patterns
Looking for Patterns
 
Chapter 9 - Characters and Strings
Chapter 9 - Characters and StringsChapter 9 - Characters and Strings
Chapter 9 - Characters and Strings
 
A regex ekon16
A regex ekon16A regex ekon16
A regex ekon16
 
Python regular expressions
Python regular expressionsPython regular expressions
Python regular expressions
 
regular-expression.pdf
regular-expression.pdfregular-expression.pdf
regular-expression.pdf
 
Regex startup
Regex startupRegex startup
Regex startup
 
JavaScript - Chapter 9 - TypeConversion and Regular Expressions
 JavaScript - Chapter 9 - TypeConversion and Regular Expressions  JavaScript - Chapter 9 - TypeConversion and Regular Expressions
JavaScript - Chapter 9 - TypeConversion and Regular Expressions
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
regex.pptx
regex.pptxregex.pptx
regex.pptx
 
Maxbox starter20
Maxbox starter20Maxbox starter20
Maxbox starter20
 
DEE 431 Introduction to MySql Slide 6
DEE 431 Introduction to MySql Slide 6DEE 431 Introduction to MySql Slide 6
DEE 431 Introduction to MySql Slide 6
 
Python - Lecture 7
Python - Lecture 7Python - Lecture 7
Python - Lecture 7
 

Plus de Sudharsan S (20)

Xml1111
Xml1111Xml1111
Xml1111
 
Xml11
Xml11Xml11
Xml11
 
Xml plymouth
Xml plymouthXml plymouth
Xml plymouth
 
Xml Presentation-3
Xml Presentation-3Xml Presentation-3
Xml Presentation-3
 
Xml Presentation-1
Xml Presentation-1Xml Presentation-1
Xml Presentation-1
 
XML Presentation-2
XML Presentation-2XML Presentation-2
XML Presentation-2
 
Xml
XmlXml
Xml
 
Unix Shell Scripting Basics
Unix Shell Scripting BasicsUnix Shell Scripting Basics
Unix Shell Scripting Basics
 
Unix
UnixUnix
Unix
 
Introduction to Unix
Introduction to UnixIntroduction to Unix
Introduction to Unix
 
Unix
UnixUnix
Unix
 
C Lecture
C LectureC Lecture
C Lecture
 
C Tutorials
C TutorialsC Tutorials
C Tutorials
 
C Introduction
C IntroductionC Introduction
C Introduction
 
College1
College1College1
College1
 
C Programming
C ProgrammingC Programming
C Programming
 
C Tutorials
C TutorialsC Tutorials
C Tutorials
 
Preface
PrefacePreface
Preface
 
Toc Sg
Toc SgToc Sg
Toc Sg
 
Les06
Les06Les06
Les06
 

Dernier

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 

Dernier (20)

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 

Les08

  • 2.
  • 3. Regular Expression Overview ABC A method of describing both simple and complex patterns for searching and manipulating Several new functions to support regular expressions A multilingual regular expression support for SQL and PLSQL string types
  • 4.
  • 5. Using Meta Characters Problem: Find 'abc' within a string: Solution: 'abc' Matches: abc Does not match: 'def' Problem: To find 'a' followed by any character, followed by 'c' Meta Character: any character is defined by '.' Solution: 'a.c' Matches: abc Matches: adc Matches: alc Matches: a&c Does not match: abb Problem: To find one or more occurrences of 'a' Meta Character: Use'+' sign to match one or more of the previous characters Solution: 'a+' Matches: a Matches: aa Does not match: bbb 1 2 3
  • 7. Regular Expression Functions Searches for a given string for a regular expression pattern and returns the position where the match is found REGEXP_INSTR Searches for a regular expression pattern within a given string and returns the matched substring REGEXP_SUBSTR Searches for a regular expression pattern and replaces it with a replacement string REGEXP_REPLACE Similar to the LIKE operator, but performs regular expression matching instead of simple pattern matching REGEXP_LIKE Description Function Name
  • 8. The REGEXP Function Syntax REGEXP_LIKE (srcstr, pattern [,match_option]) REGEXP_INSTR (srcstr, pattern [, position [, occurrence [, return_option [, match_option]]]]) REGEXP_SUBSTR (srcstr, pattern [, position [, occurrence [, match_option]]]) REGEXP_REPLACE(srcstr, pattern [,replacestr [, position [, occurrence [, match_option]]]])
  • 9. Performing Basic Searches SELECT first_name, last_name FROM employees WHERE REGEXP_LIKE (first_name, '^Ste(v|ph)en$');
  • 10. Checking the Presence of a Pattern SELECT street_address, REGEXP_INSTR(street_address,'[^[:alpha:]]') FROM locations WHERE REGEXP_INSTR(street_address,'[^[:alpha:]]')> 1;
  • 11. Example of Extracting Substrings SELECT REGEXP_SUBSTR(street_address , ' [^ ]+ ') "Road" FROM locations; …
  • 12. Replacing Patterns SELECT REGEXP_REPLACE( country_name, '(.)', ' ') "REGEXP_REPLACE" FROM countries; …
  • 13. Regular Expressions and Check Constraints ALTER TABLE emp8 ADD CONSTRAINT email_addr CHECK(REGEXP_LIKE(email,'@'))NOVALIDATE ; INSERT INTO emp8 VALUES (500,'Christian','Patel',   'ChrisP2creme.com', 1234567890, '12-Jan-2004', 'HR_REP', 2000, null, 102, 40) ; 1 2
  • 14.
  • 15.
  • 16.  
  • 17.  
  • 18.  

Notes de l'éditeur

  1. Objectives In this lesson you learn to use the regular expression support feature that has been introduced in Oracle Database 10 g .
  2. Regular Expression Overview Oracle Database 10 g introduces support for Regular Expressions. The implementation complies with the Portable Operating System for UNIX (POSIX) standard, controlled by the Institute of Electrical and Electronics Engineers (IEEE), for ASCII data matching semantics and syntax. Oracle’s multilingual capabilities extend the matching capabilities of the operators beyond the POSIX standard. Regular expressions are a method of describing both simple and complex patterns for searching and manipulating. String manipulation and searching contribute to a large percentage of the logic within a Web-based application. Usage ranges from the simple: find the word “San Francisco” in a specified text; to the complex extract of all URLs from the text; to the more complex: find all words whose every second character is a vowel. When coupled with native SQL, the use of regular expressions allows for very powerful search and manipulation operations on any data stored in an Oracle database. You can use this feature to easily solve problems that would otherwise be very complex to program.
  3. Meta Characters Meta characters are special characters that have a special meaning, such as a wildcard character, a repeating character, a nonmatching character, or a range of characters. You can use several predefined meta character symbols in the pattern matching.
  4. Using Meta Characters 1. In the first example, a simple match is performed. 2. In the second example, the any character is defined as a ' . ' . This example searches for the character “ a ” followed by any character, followed by the character “ c ”. 3. The third example searches for one or more occurrences of the letter “ a .” The “ + ” character is used here to indicate a match of one or more of the previous characters. You can search for nonmatching character lists too. A nonmatching character list allows you to define a set of characters for which a match is invalid. For example, to find anything but the characters “ a ,” “ b ,” or “ c ,” you can define the “ ^ ” to indicate a nonmatch. Expression: [^abc] Matches: abcdef Matches: ghi Does not match: abc To match any letter not between “ a ” and “ i ,” you can use: Expression: [^a-i] Matches: hijk Matches: lmn Does not match: abcdefghi
  5. Using Meta Characters (continued) Match any character in list ... Matching Character List […] Match any character not in list ... Non-Matching Character List [^…] 'a|b' matches character 'a' or 'b'. Or | Treat expression ... as a unit. Subexpression or Grouping (…) Match the n th preceding subexpression, where n is an integer from 1 to 9 Back reference Treat the subsequent meta character in the expression as a literal. Escape Character Match the subsequent expression when it occurs at the beginning of a line. Beginning of Line Anchor ^ Match the preceding expression only when it occurs at the end of a line. End of Line Anchor $ Match any character belonging to the specified character class . POSIX Character Class [:class:] Match zero or one occurrence of the preceding subexpression Zero or One – Question Mark Quantifier ? Match any character Any Character – Dot . Description Operator Name Meta Character Syntax Match exactly m occurrences at least m occurrences at least m , but not more than n occurrences of the preceding subexpression Interval – Exact Count {m} {m,} {m,n} Match zero or more occurrences of the preceding subexpression Zero or More – Star Quantifier * Match one or more occurrences of the preceding subexpression One or More – Plus Quantifier +
  6. Regular Expression Functions The Oracle Database 10 g provides a set of SQL functions that you can use to search and manipulate strings using regular expressions. You can use these functions on any data type that holds character data such as CHAR , NCHAR , CLOB , NCLOB , NVARCHAR2 , and VARCHAR2 . A regular expression must be enclosed or wrapped between single quotation marks. Doing so ensures that the entire expression is interpreted by the SQL function and can improve the readability of your code. REGEXP_LIKE : This function searches a character column for a pattern. Use this function in the WHERE clause of a query to return rows matching the regular expression you specify. REGEXP_REPLACE : This function searches for a pattern in a character column and replaces each occurrence of that pattern with the pattern you specify. REGEXP_INSTR : This function searches a string for a given occurrence of a regular expression pattern. You specify which occurrence you want to find and the start position to search from. This function returns an integer indicating the position in the string where the match is found. REGEXP_SUBSTR : This function returns the actual substring matching the regular expression pattern you specify.
  7. The REGEXP Function Syntax The following table contains descriptions of the terms shown in the syntax on the slide. Occurrence to search for occurrence Option to change default matching; it can include one or more of the following values: “ c ” — uses case-sensitive matching (default) “ I ” — uses case-insensitive matching “ n ” — allows match-any-character operator “ m ” — treats source string as multiple line Character string replacing pattern Start or end position of occurrence Search starting position Regular expression Search value match_option replacestr return_option position pattern srcstr
  8. Example of REGEXP_LIKE In this query, against the EMPLOYEES  table, all employees with first names containing either Steven or Stephen are displayed. In the expression used, '^Ste(v|ph)en$' : ^ indicates the beginning of the sentence $ indicates the end of the sentence | indicates either/or
  9. Checking the Presence of a Pattern In this example, the REGEXP_INSTR function is used to search the street address to find the location of the first nonalphabetic character, regardless of whether it is in upper or lower case. The search is performed only on those addresses that do not start with a number. Note that [:<class>:] implies a character class and matches any character from within that class; [:alpha:] matches with any alphabetic character. The results are displayed. In the expression used in the query '[^[:alpha:]]' : [ starts the expression ^ indicates NOT [:alpha:] indicates alpha character class ] ends the expression Note: The POSIX character class operator enables you to search for an expression within a character list that is a member of a specific POSIX character class. You can use this operator to search for specific formatting, such as uppercase characters, or you can search for special characters such as digits or punctuation characters. The full set of POSIX character classes is supported. Use the syntax [: class :] where class is the name of the POSIX character class to search for. The following regular expression searches for one or more consecutive uppercase characters : [[:upper:]]+ .
  10. Example of Extracting a Substring In this example, the road names are extracted from the LOCATIONS table. To do this, the contents in the STREET_ADDRESS column that are before the first space are returned using the REGEXP_SUBSTR function. In the expression used in the query '[^ ]+ ' : [ starts the expression ^ indicates NOT indicates space ] ends the expression + indicates 1 or more indicates space
  11. Replacing Patterns This example examines examines COUNTRY_NAME . The Oracle database reformats this pattern with a space after each non-null character in the string. The results are shown.
  12. Regular Expressions and Check Constraints Regular expressions can also be used in check constraints. In this example, a check constraint is added on the EMAIL column of the EMPLOYEES table. This will ensure that only strings containing an “@” symbol are accepted. The constraint is tested. The check constraint is violated because the e-mail address does not contain the required symbol. The NOVALIDATE clause ensures that existing data is not checked.
  13. Summary In this lesson you have learned to use the regular expression support features that have been introduced in Oracle Database 10 g .
  14. Practice 8: Overview This practices covers searching and replacing data using regular expressions.
  15. Practice 8 Write a query to search the EMPLOYEES table for all employees whose first names start with “Ne” or “Na.” Create a query that removes the spaces in the STREET_ADDRESS column of LOCATIONS table in the display.
  16. Practice 8 (continued) 3. Create a query that displays “St” replaced by “Street” in the STREET_ADDRESS column of LOCATIONS table. Be careful that you do not affect any rows that already have “Street” in them. Display only those rows which are affected.