Regular expression
This presentation is the property of its rightful owner.
Sponsored Links
1 / 14

Regular Expression PowerPoint PPT Presentation


  • 75 Views
  • Uploaded on
  • Presentation posted in: General

Regular Expression. Dr. Tran, Van Hoai Faculty of Computer Science and Engineering HCMC Uni. of Technology [email protected] Text pattern. Used for text-processing utilities Text-pattern = normal characters + metacharacters = regular expression

Download Presentation

Regular Expression

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Regular expression

Regular Expression

Dr. Tran, Van Hoai

Faculty of Computer Science and Engineering HCMC Uni. of Technology

[email protected]


Text pattern

Text pattern

  • Used for text-processing utilities

  • Text-pattern = normal characters + metacharacters = regular expression

  • Metacharaters in regular expressions are different from those in file name expansion


Example 1

Example (1)

  • grep [A-Z]* script*.sh

    • means

      grep a.txt abc script1.sh script2.sh

  • grep "[a-z]*" script*.sh

    • means to find the pattern "[a-z]*" in "script*.sh"

  • Good and safe solutions are "" and ''


Metacharacter sets

Metacharacter sets

  • Depends on usage context

    • searching

    • replacing

  • Also depends on programs

  • Different engines

    • Perl

    • PHP

    • .NET regular expression library

    • Java JDK


Searching patterns 1

Searching patterns (1)


Searching patterns 2

Searching patterns (2)


Example 2

Example (2)


Example 3

Example (3)


Example 4

Example (4)


Example 5

Example (5)


Replacing patterns 1

Replacing patterns (1)


Example 6

Example (6)


Applications

Applications

<TAG\b[^>]*>\(.*?\)</TAG>

[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}


Regular expression

  • text processing utilities

is NEXT


  • Login