1 / 14

Regular Expression

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

fausto
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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Regular Expression Dr. Tran, Van Hoai Faculty of Computer Science and Engineering HCMC Uni. of Technology hoai@cse.hcmut.edu.vn

  2. 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

  3. 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 ''

  4. Metacharacter sets • Depends on usage context • searching • replacing • Also depends on programs • Different engines • Perl • PHP • .NET regular expression library • Java JDK

  5. Searching patterns (1)

  6. Searching patterns (2)

  7. Example (2)

  8. Example (3)

  9. Example (4)

  10. Example (5)

  11. Replacing patterns (1)

  12. Example (6)

  13. Applications <TAG\b[^>]*>\(.*?\)</TAG> [A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}

  14. text processing utilities is NEXT

More Related