Regular expression
Download
1 / 14

Regular Expression - PowerPoint PPT Presentation


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

Regular Expression. Dr. Tran, Van Hoai Faculty of Computer Science and Engineering HCMC Uni. of Technology hoai@cse.hcmut.edu.vn. Text pattern. Used for text-processing utilities Text-pattern = normal characters + metacharacters = regular expression

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha

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

Dr. Tran, Van Hoai

Faculty of Computer Science and Engineering HCMC Uni. of Technology

hoai@cse.hcmut.edu.vn


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)

  • 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

  • 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 (2)


Example (2)


Example (3)


Example (4)


Example (5)


Replacing patterns (1)


Example (6)


Applications

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

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


  • text processing utilities

is NEXT


ad
  • Login