ADVANCE FIND & REPLACE WITH REGULAR EXPRESSIONS

Slides:



Advertisements
Similar presentations
Searching using regular expressions. A regular expression is also a ‘special text string’ for describing a search pattern. Regular expressions define.
Advertisements

Regular Expressions in Perl By Josue Vazquez. What are Regular Expressions? A template that either matches or doesn’t match a given string. Often called.
1 Chapter 2 Introduction to Java Applications Introduction Java application programming Display ____________________ Obtain information from the.
Regular Expression Original Notes by Song Guo. What Regular Expressions Are Exactly - Terminology a regular expression is a pattern describing a certain.
LING 388: Language and Computers Sandiway Fong Lecture 2: 8/23.
CS 330 Programming Languages 10 / 10 / 2006 Instructor: Michael Eckmann.
Regular expressions Mastering Regular Expressions by Jeffrey E. F. Friedl Linux editors and commands (e.g.
Scripting Languages Chapter 8 More About Regular Expressions.
REGULAR EXPRESSIONS CHAPTER 14. REGULAR EXPRESSIONS A coded pattern used to search for matching patterns in text strings Commonly used for data validation.
Last Updated March 2006 Slide 1 Regular Expressions.
Language Recognizer Connecting Type 3 languages and Finite State Automata Copyright © – Curt Hill.
Overview of the grep Command Alex Dukhovny CS 265 Spring 2011.
Regular Expression Darby Tien-Hao Chang (a.k.a. dirty) Department of Electrical Engineering, National Cheng Kung University.
System Programming Regular Expressions Regular Expressions
 Text Manipulation and Data Collection. General Programming Practice Find a string within a text Find a string ‘man’ from a ‘A successful man’
RegExp. Regular Expression A regular expression is a certain way to describe a pattern of characters. Pattern-matching or keyword search. Regular expressions.
Regular Expressions Regular expressions are a language for string patterns. RegEx is integral to many programming languages:  Perl  Python  Javascript.
Perl and Regular Expressions Regular Expressions are available as part of the programming languages Java, JScript, Visual Basic and VBScript, JavaScript,
Agenda Regular Expressions (Appendix A in Text) –Definition / Purpose –Commands that Use Regular Expressions –Using Regular Expressions –Using the Replacement.
1 CSC 594 Topics in AI – Text Mining and Analytics Fall 2015/16 4. Document Search and Regular Expressions.
I/O Redirection and Regular Expressions February 9 th, 2004 Class Meeting 4.
REGEX. Problems Have big text file, want to extract data – Phone numbers (503)
Overview A regular expression defines a search pattern for strings. Regular expressions can be used to search, edit and manipulate text. The pattern defined.
Working with Forms and Regular Expressions Validating a Web Form with JavaScript.
When you read a sentence, your mind breaks it into tokens—individual words and punctuation marks that convey meaning. Compilers also perform tokenization.
Regular Expressions for PHP Adding magic to your programming. Geoffrey Dunn
GREP. Whats Grep? Grep is a popular unix program that supports a special programming language for doing regular expressions The grammar in use for software.
May 2008CLINT-LIN Regular Expressions1 Introduction to Computational Linguistics Regular Expressions (Tutorial derived from NLTK)
CS 330 Programming Languages 10 / 02 / 2007 Instructor: Michael Eckmann.
I/O Redirection & Regular Expressions CS 2204 Class meeting 4 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
CSC 2720 Building Web Applications PHP PERL-Compatible Regular Expressions.
Copyright © Curt Hill Regular Expressions Providing a Search Pattern.
Regular Expressions CS 2204 Class meeting 6 Created by Doug Bowman, 2001 Modified by Mir Farooq Ali, 2002.
Created by Branden Maglio and Flynn Castellanos Team BFMMA.
Unit 11 –Reglar Expressions Instructor: Brent Presley.
CGS – 4854 Summer 2012 Web Site Construction and Management Instructor: Francisco R. Ortega Chapter 5 Regular Expressions.
Introduction to Programming the WWW I CMSC Winter 2004 Lecture 13.
-Joseph Beberman *Some slides are inspired by a PowerPoint presentation used by professor Seikyung Jung, which was derived from Charlie Wiseman.
CS 330 Programming Languages 09 / 30 / 2008 Instructor: Michael Eckmann.
May 2006CLINT-LIN Regular Expressions1 Introduction to Computational Linguistics Regular Expressions (Tutorial derived from NLTK)
Hands-on Regular Expressions Simple rules for powerful changes.
RE Tutorial.
Finding the needle(s) in the textual haystack
Excel STDEV.S Function.
Regular Expressions Upsorn Praphamontripong CS 1110
Theory of Computation Lecture #
Strings and Serialization
Looking for Patterns - Finding them with Regular Expressions
CSC 594 Topics in AI – Natural Language Processing
Regular Expressions and perl
Finding the needle(s) in the textual haystack
Week 14 - Friday CS221.
Regular Expression Beihang Open Source Club.
Finding the needle(s) in the textual haystack
CSC 594 Topics in AI – Natural Language Processing
Pattern Matching in Strings
The ‘grep’ Command Colin Masterson.
Advanced Find and Replace with Regular Expressions
CSCI 431 Programming Languages Fall 2003
Functions, Regular expressions and Events
CS 1111 Introduction to Programming Fall 2018
Regular Expressions
Lecture 25: Regular Expressions
- Regular expressions:
Regular Expressions grep Familiy of Commands
Regular Expression in Java 101
REGEX.
Regular Expressions.
Presentation transcript:

ADVANCE FIND & REPLACE WITH REGULAR EXPRESSIONS CHRISTOPHER ZACK| OMNIUPDATE

Agenda Find & Replace History of Regular Expressions ADVANCE FIND & REPLACE WITH REGULAR EXPRESSIONS Find & Replace History of Regular Expressions Literal Character Search Special Characters Period Quantifiers Parentheses Square Brackets Shorthand Character Classes Greedy Matches

Find & Replace Location: Content > Find and Replace ADVANCE FIND & REPLACE WITH REGULAR EXPRESSIONS Location: Content > Find and Replace Administrators Only (User Level 10) Searches a single site Adjust scope to limit searchable content Literal Text or Regular Expression

Find & Replace Find Simple search with results list. Preview Replace ADVANCE FIND & REPLACE WITH REGULAR EXPRESSIONS Find Simple search with results list. Preview Replace Safe multi-step process Perform ‘sample’ find/replace and display results list. Select pages from results to perform the actual find/replace operation. Publish selected results (optional).

History of Regular Expressions ADVANCE FIND & REPLACE WITH REGULAR EXPRESSIONS Regular Expression A pattern that describes a certain amount of text. The concept arose in the 1950s when the American mathematician Stephen Cole description of a regular language. Now used in almost every major programming language.

Literal Character Search ADVANCE FIND & REPLACE WITH REGULAR EXPRESSIONS Literal Text Matches Most characters match exactly themselves (beware of whitespace) Case Sensitive Great way to get a general idea of how many items will at least need to be captured if you need to generate a regular expression “find.” Example of literal find

Special Characters Symbol characters that have special purpose: ADVANCE FIND & REPLACE WITH REGULAR EXPRESSIONS Symbol characters that have special purpose: \ ^ $ . | ? * ( ) [ ] { } To match as literal characters, you must escape them by adding a backslash “\” in front of said special character.

Special Characters: Period ADVANCE FIND & REPLACE WITH REGULAR EXPRESSIONS The period character is the “wildcard” character Will match any character except a newline (\n)

Special Characters: Quantifiers ADVANCE FIND & REPLACE WITH REGULAR EXPRESSIONS Symbol characters that define how many of the previous character(s) to match ? (0 or 1) * (0 or more) + (1 or more) Use curly brackets to indicate an exact number or range {3} (Exactly 3) {3,} (3 or more) {3,5} (3, 4, or 5) Only modifies the previous character (or group)

Special Characters: Parenthesis ADVANCE FIND & REPLACE WITH REGULAR EXPRESSIONS Capture Groups Encapsulate a character sequence using parentheses: “(…)” Add a quantifier to affect the whole group Replace In the “replace field,” refer to your groups using the dollar sign and then the group number: $# Count the opening parenthesis characters, “(“, to determine the correct #

Special Characters: Square Brackets ADVANCE FIND & REPLACE WITH REGULAR EXPRESSIONS Character Sets Characters encased inside square brackets define all possible matches for a single text character: [abc] A quantifier place directly after the set will affect the whole character set Placing a “-” hyphen between characters indicates a range Placing a “^” caret as the first item in the set creates a negative pattern Quantifier characters become literal matches: ? + * { } Placing a “.” period becomes literal match

Shorthand Character Classes ADVANCE FIND & REPLACE WITH REGULAR EXPRESSIONS Certain characters can reference a range of characters when escaped by a backslash “\” Examples: “\d” matches all digit characters: [0-9] “\w” matches all word characters: [A-Za-z0-9] “\s” matches all whitespace characters (including line breaks) Using the capital letter will inverse the match “\S” matches all non-space characters: [^\s] \d{3}-\d{4}

[\s\S]*? Greedy Matches ADVANCE FIND & REPLACE WITH REGULAR EXPRESSIONS When using quantifiers, a careless (or purposeful) pattern could match beyond an expected result Applying an extra “?” question mark character after the initial quantifier, to make the pattern stop at the first successful match [\s\S]*?

THANK YOU! PLEASE SHARE YOUR FEEDBACK: WWW.SLIDO.COM #OUTC19