1 / 7

RE review (Perl syntax)

RE review (Perl syntax). single-character disjunction: [aeiou] ranges: [0-9] negation: [^aeiou] matching zero or one: /cats?/. Conjunction. Two regular expressions are conjoined by juxtaposition (placing the expressions side by side). Examples: /a/ matches ‘a’ /m/ matches ‘m’

bowie
Download Presentation

RE review (Perl syntax)

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. RE review (Perl syntax) single-character disjunction: [aeiou] ranges: [0-9] negation: [^aeiou] matching zero or one: /cats?/ CSE 467/567

  2. Conjunction Two regular expressions are conjoined by juxtaposition (placing the expressions side by side). Examples: /a/ matches ‘a’ /m/ matches ‘m’ /am/ matches ‘am’ but not ‘a’ or ‘m’ alone CSE 467/567

  3. The Kleene star and plus The Kleene star (*) matches zero or more occurrences of the preceding expression. Examples: /a*/ matches ‘’, ‘a’, ‘aa’, ‘aaa’, etc. /[ab]*/ matches ‘’, ‘a’, ‘b’, ‘aa’, ‘ab’, ‘ba’, ‘bb’, etc. + matches one or more occurrences CSE 467/567

  4. Wildcard The period (.) matches any single character except the newline (\n). CSE 467/567

  5. Anchors Anchors are used to restrict a match to a particular position within a string. ^ anchors to the start of a line $ anchors to the end of a line \b anchors to a word boundary \B anchors to a non-boundary CSE 467/567

  6. Grouping • () group CSE 467/567

  7. Disjunction We have already seen disjunction of characters using the square bracket notation General disjunction is expressed using the vertical bar (|), also called the pipe symbol. CSE 467/567

More Related