1 / 31

RegExp Theory

RegExp Theory. Finite State Machines. What is a FSM?. Used in CS theory classes Learned before more complex machines like the Turing Machine We’ll use a specific machine and a standard language (grammar) Grep Patterns are a language for a common text Finite State Machine. Pattern Searching.

Download Presentation

RegExp Theory

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. RegExp Theory

  2. Finite State Machines

  3. What is a FSM? • Used in CS theory classes • Learned before more complex machines like the Turing Machine • We’ll use a specific machine and a standard language (grammar) • Grep Patterns are a language for a common text Finite State Machine

  4. Pattern Searching

  5. Search 4 a String • fjdklswmcpgtwbvkgfksdsopkdmebcipwmzniugmcttcsctwbvcvoppqmzlgfdwhncishhadsjwbaozhjakwoiatqva • find “sct” in the string the above text • think about how you looked for it

  6. Example Pattern Match C T T Input we are searching in: C C T C S C T S Searching for:

  7. Example Pattern Match C Machine State Position in the input T T C C T C S C T S Searching for: Input we are searching in

  8. Example Pattern Match C Machine State Position in the input T T C C T C S C T S Searching for: Input we are searching in

  9. Example Pattern Match C T T C C T C S C T S Searching for: Input we are searching in

  10. Example Pattern Match C T T C C T C S C T S Searching for: Input we are searching in

  11. Example Pattern Match C T T C C T C S C T S Searching for: Input we are searching in

  12. Example Pattern Match T C C T C S C T S Searching for: Input we are searching in

  13. Example Pattern Match C C T C S C T S Searching for: Input we are searching in A Match was found

  14. Vague Searches • Search multiple times • repeat the process X times • Wildcard / Variable • Find: *, Any_Shape • How do you write this down in a concise way?

  15. Example Pattern Match Searching for: ANY Input we are searching in Shape MATCH

  16. Example Pattern Match Searching for: ANY Input we are searching in

  17. Example Pattern Match Searching for: ANY Input we are searching in NOPE

  18. Example Pattern Match Searching for: ANY Input we are searching in

  19. Example Pattern Match Searching for: ANY Input we are searching in Shape MATCH

  20. Example Pattern Match Searching for: ANY Input we are searching in NO match

  21. Example Pattern Match Searching for: ANY Input we are searching in Shape MATCH

  22. Example Pattern Match Searching for: ANY Input we are searching in Shape MATCH

  23. Example Pattern Match Searching for: ANY Input we are searching in No MATCH

  24. Example Pattern Match Searching for: ANY Input we are searching in

  25. Example Pattern Match Searching for: ANY Input we are searching in Shape MATCH

  26. Example Pattern Match Searching for: ANY Input we are searching in No MATCH

  27. Example Pattern Match Searching for: ANY Input we are searching in Shape MATCH

  28. Example Pattern Match Searching for: ANY Input we are searching in Shape MATCH

  29. Example Pattern Match Searching for: ANY Input we are searching in Shape MATCH

  30. Example Pattern Match Searching for: ANY Input we are searching in Shape MATCH! WE FOUND IT

More Related