regularexpression-180328061400.pptx hehe

anthonykharl6 4 views 13 slides May 16, 2024
Slide 1
Slide 1 of 13
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13

About This Presentation

Wen


Slide Content

Regular Expression MANOJ K. https://www.drupal.org/u/manojapare @manojapare

What is regular expression? Usage of regular expression? Basics Agenda

What is regular expression? A sequence of characters that define a search pattern. The concept arose in the 1950s when the American mathematician Stephen Cole Kleene formalized the description of a regular language. The concept came into common use with Unix text-processing utilities.

Usage of regular expression? Regular expressions are used in Search engines Search and replace dialogs of word processors and text editors Text processing utilities such as sed and AWK and in lexical analysis. Many programming languages provide regex capabilities, built-in or via libraries.

Basics Character classes Anchors Escaped Characters Groups & Lookaround Quantifiers & Alternation

Character classes . any character except newline \w \d \s word, digit, whitespace \W \D \S not word, not digit, not whitespace [abc] any of a, b, or c [^abc] not a, b, or c [a-g] character between a & g

Anchors ^abc$ start / end of the string \b \B word boundary, not-word boundary

Escaped Characters \. \* \\ escaped special characters \t \n \r tab, linefeed, carriage return \u00A9 unicode escaped ©

Groups & Lookaround (abc) capture group \1 backreference to group #1 (?:abc) non-capturing group (?=abc) positive lookahead (?!abc) negative lookahead

Quantifiers & Alternation a* a+ a? 0 or more, 1 or more, 0 or 1 a{5} a{2,} exactly five, two or more a{1,3} between one & three a+? A{2,}? match as few as possible ab|cd match ab or cd

Examples

References https://en.wikipedia.org/wiki/Regular_expression https://regexr.com/

THANKS! QUESTIONS?
Tags