1 / 7

Regular Expressions

Regular Expressions. 1. Types of Regular Languages. Must contain a substring Must contain certain symbols Concatenation Union Closure (*) Parity. Uses of Regular Language. Validation of strings such as passwords. Checking for existence of substring.

clint
Download Presentation

Regular Expressions

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 Expressions 1

  2. Types of Regular Languages Must contain a substring Must contain certain symbols Concatenation Union Closure (*) Parity

  3. Uses of Regular Language Validation of strings such as passwords. Checking for existence of substring. Finding first occurrence of substring. Pattern matching

  4. Regular Expressions (REX) String notation to define patterns Any regular language can be expressed as a regular expression and vice versa. Given REX can generate DFA

  5. Formal Definition e is a regular expression (REX) over  if e is • λ, • , • a, for some a  Σ, • (e1 + e2), where e1 and e2 are REXs over , • (e1 . e2), where e1 and e2 are REXs over , or • (e1*), where e1 and e2 are REXs over .

  6. Examples

  7. Examples (Defined over {0,1}*) • L1={w | w contains substring 01} • L2={w | |w| is even} • L3={w | |w| is odd} • L4={w | w starts and ends with 1}

More Related