Computing Unit 3: Data Types

Similar documents
Text & Patterns. stat 579 Heike Hofmann

Regex, Sed, Awk. Arindam Fadikar. December 12, 2017

Lecture 5, Regular Expressions September 2014

psed [-an] script [file...] psed [-an] [-e script] [-f script-file] [file...]

Configuring the RADIUS Listener LEG

More Scripting and Regular Expressions. Todd Kelley CST8207 Todd Kelley 1

Regular Expressions Overview Suppose you needed to find a specific IPv4 address in a bunch of files? This is easy to do; you just specify the IP

Regular Expressions. Todd Kelley CST8207 Todd Kelley 1

Configuring the RADIUS Listener Login Event Generator

CS Unix Tools & Scripting

Paolo Santinelli Sistemi e Reti. Regular expressions. Regular expressions aim to facilitate the solution of text manipulation problems

- c list The list specifies character positions.

CS 301. Lecture 05 Applications of Regular Languages. Stephen Checkoway. January 31, 2018

Data Cleaning. Andrew Jaffe. January 6, 2016

Bashed One Too Many Times. Features of the Bash Shell St. Louis Unix Users Group Jeff Muse, Jan 14, 2009

CS Advanced Unix Tools & Scripting

ISO/IEC JTC1/SC22/WG20 N

Regular Expressions 1

Reference number of working document: Reference number of document: ISO/IEC FCD

Information technology. Specification method for cultural conventions ISO/IEC JTC1/SC22/WG20 N690. Reference number of working document:

Describing Languages with Regular Expressions

Lecture 15: Regular expressions in R

Regular Expressions. Regular Expression Syntax in Python. Achtung!

UNIX / LINUX - REGULAR EXPRESSIONS WITH SED

BoredGames Language Reference Manual A Language for Board Games. Brandon Kessler (bpk2107) and Kristen Wise (kew2132)

BNF, EBNF Regular Expressions. Programming Languages,

GNU Bash. an introduction to advanced usage. James Pannacciulli Systems Engineer.

TECHNICAL ISO/IEC REPORT TR 14652

Package stringb. November 1, 2016

Pattern Matching. An Introduction to File Globs and Regular Expressions

Recitation 2: Strings and RegExp Statistical Computing, Monday September 28, 2015

Pattern Matching. An Introduction to File Globs and Regular Expressions. Adapted from Practical Unix and Programming Hunter College

looks at class of input and calls appropriate function

MTAT Agile Software Development in the Cloud Lecture 4: More on Ruby

CSE 311 Lecture 21: Context-Free Grammars. Emina Torlak and Kevin Zatloukal

Kurt Schmidt. October 19, 2017

Package stringr. February 15, 2013

Regular Expressions. Regular expressions match input within a line Regular expressions are very different than shell meta-characters.

Linux Text Utilities 101 for S/390 Wizards SHARE Session 9220/5522

MTAT Agile Software Development in the Cloud. Lecture 3: Ruby (cont.)

FIPA ACL Message Representation in String Specification

Features of C. Portable Procedural / Modular Structured Language Statically typed Middle level language

Part III. Shell Config. Tobias Neckel: Scripting with Bash and Python Compact Max-Planck, February 16-26,

INTERNATIONAL ISO/IEC WD10 STANDARD. Information technology Specification methods for cultural conventions

FIPA ACL Message Representation in String Specification

Configuring the RADIUS Listener Login Event Generator

NAME nawk pattern-directed scanning and processing language. SYNOPSIS nawk [ F fs ][ v var=value ][ prog f progfile ][file... ]

ISO/IEC INTERNATIONAL STANDARD. Information technology - Syntactic metalanguage - Extended BNF

Typescript on LLVM Language Reference Manual

Object-Oriented Software Engineering CS288

Number System. Introduction. Natural Numbers (N) Whole Numbers (W) Integers (Z) Prime Numbers (P) Face Value. Place Value

DINO. Language Reference Manual. Author: Manu Jain

Object oriented programming. Instructor: Masoud Asghari Web page: Ch: 3

Tom Lord except the chapter "Posix Entry Points" from The GNU C Library reference manual by Sandra Loosemore with Richard M.

Regular Expressions. Computer Science and Engineering College of Engineering The Ohio State University. Lecture 9

Digital Data Collection - getting started

Lesson 06 Arrays. MIT 11053, Fundamentals of Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT FMC, SEUSL

The SPL Programming Language Reference Manual

CS160A EXERCISES-FILTERS2 Boyd

Input File Syntax The parser expects the input file to be divided into objects. Each object must start with the declaration:

Introduction to Regular Expressions Version 1.3. Tom Sgouros

Topic 4: Grep, Find & Sed

Server-side Web Development (I3302) Semester: 1 Academic Year: 2017/2018 Credits: 4 (50 hours) Dr Antoun Yaacoub

CSE 374 Programming Concepts & Tools. Laura Campbell (thanks to Hal Perkins) Winter 2014 Lecture 6 sed, command-line tools wrapup

Microsoft Visual Basic 2005: Reloaded

Retrieving Data Using the SQL SELECT Statement. Copyright 2004, Oracle. All rights reserved.

Systems Programming/ C and UNIX

The PCAT Programming Language Reference Manual

Developing a Basic Web Page

CS214-AdvancedUNIX. Lecture 2 Basic commands and regular expressions. Ymir Vigfusson. CS214 p.1

Honu. Version November 6, 2010

COMP1730/COMP6730 Programming for Scientists. Strings

This book is licensed under a Creative Commons Attribution 3.0 License

Lec-5-HW-1, TM basics

MELODY. Language Reference Manual. Music Programming Language

Introduction to modeling

JME Language Reference Manual

Package tau. R topics documented: September 27, 2017

Programming Languages & Compilers. Programming Languages and Compilers (CS 421) Programming Languages & Compilers. Major Phases of a Compiler

Programming Languages and Compilers (CS 421)

Programming Languages & Compilers. Programming Languages and Compilers (CS 421) I. Major Phases of a Compiler. Programming Languages & Compilers

Regular Expressions. Regular expressions are a powerful search-and-replace technique that is widely used in other environments (such as Unix and Perl)

More text file manipulation: sorting, cutting, pasting, joining, subsetting,

IPCoreL. Phillip Duane Douglas, Jr. 11/3/2010

GNU Grep: Print lines matching a pattern

Regular Expressions. Michael Wrzaczek Dept of Biosciences, Plant Biology Viikki Plant Science Centre (ViPS) University of Helsinki, Finland

Perl Regular Expressions Perl is renowned for its excellence in text processing. Regular expressions area big factor behind this fame.

正则表达式 Frank from

Ordinary Differential Equation Solver Language (ODESL) Reference Manual

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

GNU Grep: Print lines matching a pattern

Technical Questions. Q 1) What are the key features in C programming language?

STREAM EDITOR - REGULAR EXPRESSIONS

Published by O Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472

Learning Language. Reference Manual. George Liao (gkl2104) Joseanibal Colon Ramos (jc2373) Stephen Robinson (sar2120) Huabiao Xu(hx2104)

LDAP Filters and Searching LDAP Directories Solutions

Shells & Shell Programming (Part B)

GNU Bash. An Introduction to Advanced Usage. James Pannacciulli Systems (mt) Media Temple

Sprite an animation manipulation language Language Reference Manual

Retrieving Data Using the SQL SELECT Statement. Copyright 2004, Oracle. All rights reserved.

Transcription:

Computing Unit 3: Data Types Kurt Hornik September 26, 2018

Character vectors String constants: enclosed in "... " (double quotes), alternatively single quotes. Slide 2

Character vectors String constants: enclosed in "... " (double quotes), alternatively single quotes. C-style special characters in double-quoted string constants: \a \n \t \\ \" etc. Slide 2

Character vectors String constants: enclosed in "... " (double quotes), alternatively single quotes. C-style special characters in double-quoted string constants: \a \n \t \\ \" etc. Combination using c(). Slide 2

Character vectors String constants: enclosed in "... " (double quotes), alternatively single quotes. C-style special characters in double-quoted string constants: \a \n \t \\ \" etc. Combination using c(). Elementwise equality using == Slide 2

Character vectors String constants: enclosed in "... " (double quotes), alternatively single quotes. C-style special characters in double-quoted string constants: \a \n \t \\ \" etc. Combination using c(). Elementwise equality using == Creation and testing of character vectors using character et al. Slide 2

Character vectors nchar count the number of characters Slide 3

Character vectors nchar count the number of characters substr, substring extract or replace substrings Slide 3

Character vectors nchar count the number of characters substr, substring extract or replace substrings paste concatenate vectors after converting to character Slide 3

Character vectors nchar count the number of characters substr, substring extract or replace substrings paste concatenate vectors after converting to character sprintf C-style string formatting Slide 3

Character vectors nchar count the number of characters substr, substring extract or replace substrings paste concatenate vectors after converting to character sprintf C-style string formatting iconv convert between encodings Slide 3

Character vectors nchar count the number of characters substr, substring extract or replace substrings paste concatenate vectors after converting to character sprintf C-style string formatting iconv convert between encodings chartr, toupper, tolower character translation and case folding Slide 3

Character vectors match, pmatch (simple) complete and partial matching of character strings Slide 4

Character vectors match, pmatch (simple) complete and partial matching of character strings grep, grepl, sub, gsub, regexpr, gregexpr pattern matching and replacement using regular expressions Slide 4

Character vectors match, pmatch (simple) complete and partial matching of character strings grep, grepl, sub, gsub, regexpr, gregexpr pattern matching and replacement using regular expressions strsplit split strings into substrings Slide 4

Regular Expressions A regular expression ( regexp, RE ) is a pattern that denotes a (possibly infinite) set of strings. Slide 5

Regular Expressions A regular expression ( regexp, RE ) is a pattern that denotes a (possibly infinite) set of strings. Portable Operating System Interface (POSIX) 1003.2 defines modern extended regexps, and obsolete basic regexps. Slide 5

Regular Expressions A regular expression ( regexp, RE ) is a pattern that denotes a (possibly infinite) set of strings. Portable Operating System Interface (POSIX) 1003.2 defines modern extended regexps, and obsolete basic regexps. REs have a syntax in which a few characters are special constructs and the rest are ordinary. Slide 5

Regular Expressions A regular expression ( regexp, RE ) is a pattern that denotes a (possibly infinite) set of strings. Portable Operating System Interface (POSIX) 1003.2 defines modern extended regexps, and obsolete basic regexps. REs have a syntax in which a few characters are special constructs and the rest are ordinary. An ordinary character is a simple regexp matching just itself. Slide 5

Regular Expressions A regular expression ( regexp, RE ) is a pattern that denotes a (possibly infinite) set of strings. Portable Operating System Interface (POSIX) 1003.2 defines modern extended regexps, and obsolete basic regexps. REs have a syntax in which a few characters are special constructs and the rest are ordinary. An ordinary character is a simple regexp matching just itself. ERE special characters:. * +? ^ $ \ [ ] ( ) { }. Slide 5

Regular Expressions A regular expression ( regexp, RE ) is a pattern that denotes a (possibly infinite) set of strings. Portable Operating System Interface (POSIX) 1003.2 defines modern extended regexps, and obsolete basic regexps. REs have a syntax in which a few characters are special constructs and the rest are ordinary. An ordinary character is a simple regexp matching just itself. ERE special characters:. * +? ^ $ \ [ ] ( ) { }. Any non-special character is ordinary unless preceded by a \. Slide 5

Regexp Special Characters. Matches any single character. Slide 6

Regexp Special Characters. Matches any single character. * Postfix operator: matches the preceding regexp as many times as possible (zero or more). Slide 6

Regexp Special Characters. Matches any single character. * Postfix operator: matches the preceding regexp as many times as possible (zero or more). + Postfix operator: matches the preceding regexp as many times as possible, but at least once. Slide 6

Regexp Special Characters. Matches any single character. * Postfix operator: matches the preceding regexp as many times as possible (zero or more). + Postfix operator: matches the preceding regexp as many times as possible, but at least once.? Postfix operator: matches the preceding regexp once or not at all. Slide 6

Regexp Special Characters. Matches any single character. * Postfix operator: matches the preceding regexp as many times as possible (zero or more). + Postfix operator: matches the preceding regexp as many times as possible, but at least once.? Postfix operator: matches the preceding regexp once or not at all. ˆ Matches the null string at the beginning of a line Slide 6

Regexp Special Characters. Matches any single character. * Postfix operator: matches the preceding regexp as many times as possible (zero or more). + Postfix operator: matches the preceding regexp as many times as possible, but at least once.? Postfix operator: matches the preceding regexp once or not at all. ˆ Matches the null string at the beginning of a line $ Matches the null string at the end of a line Slide 6

Regexp Special Characters. Matches any single character. * Postfix operator: matches the preceding regexp as many times as possible (zero or more). + Postfix operator: matches the preceding regexp as many times as possible, but at least once.? Postfix operator: matches the preceding regexp once or not at all. ˆ Matches the null string at the beginning of a line $ Matches the null string at the end of a line specifies an alternative (applies to the largest possible surrounding). Slide 6

Regexp Special Characters. Matches any single character. * Postfix operator: matches the preceding regexp as many times as possible (zero or more). + Postfix operator: matches the preceding regexp as many times as possible, but at least once.? Postfix operator: matches the preceding regexp once or not at all. ˆ Matches the null string at the beginning of a line $ Matches the null string at the end of a line specifies an alternative (applies to the largest possible surrounding). \ Quotes special characters, and introduces additional special constructs. Slide 6

Regexp Character Alternatives [... ] is a character alternative (bracket expression) matching one of the specified characters. Slide 7

Regexp Character Alternatives [... ] is a character alternative (bracket expression) matching one of the specified characters. Character ranges can be included by writing the starting and ending characters with a - between them. Slide 7

Regexp Character Alternatives [... ] is a character alternative (bracket expression) matching one of the specified characters. Character ranges can be included by writing the starting and ending characters with a - between them. Inside character alternatives, the following are special: ] - ^. Slide 7

Regexp Character Alternatives [... ] is a character alternative (bracket expression) matching one of the specified characters. Character ranges can be included by writing the starting and ending characters with a - between them. Inside character alternatives, the following are special: ] - ^. [ˆ... ] is a complementary character alternative matching any character except the ones specified. Slide 7

Regexp Character Alternatives [... ] is a character alternative (bracket expression) matching one of the specified characters. Character ranges can be included by writing the starting and ending characters with a - between them. Inside character alternatives, the following are special: ] - ^. [ˆ... ] is a complementary character alternative matching any character except the ones specified. Inside a character alternative, one can also use character classes by enclosing their names in [:... :] (character classes are alnum, alpha, blank, cntrl, digit, graph, lower, print, punct, space, upper, xdigit). Slide 7

Regexp Grouping (... ) specifies a grouping. Used 1. to enclose a set of alternatives; Slide 8

Regexp Grouping (... ) specifies a grouping. Used 1. to enclose a set of alternatives; 2. to enclose a complicated expression for the postfix operators; Slide 8

Regexp Grouping (... ) specifies a grouping. Used 1. to enclose a set of alternatives; 2. to enclose a complicated expression for the postfix operators; 3. record a matched substring for future reference with \DIGIT Slide 8

Regexp Bounds {... } specifies a bound on the preceding regexp (atom). Slide 9

Regexp Bounds {... } specifies a bound on the preceding regexp (atom). 1. {m}, 0 m 255, matches a sequence of exactly m repetitions of the preceding regexp. Slide 9

Regexp Bounds {... } specifies a bound on the preceding regexp (atom). 1. {m}, 0 m 255, matches a sequence of exactly m repetitions of the preceding regexp. 2. {m,}, 0 m 255, matches a sequence of at least m repetitions of the preceding regexp. Slide 9

Regexp Bounds {... } specifies a bound on the preceding regexp (atom). 1. {m}, 0 m 255, matches a sequence of exactly m repetitions of the preceding regexp. 2. {m,}, 0 m 255, matches a sequence of at least m repetitions of the preceding regexp. 3. {m,n}, 0 m n 255, matches a sequence of m through n (inclusive) repetitions of the preceding regexp. Slide 9