LING/C SC/PSYC 438/538 Online Lecture 7 Sandiway Fong.

Slides:



Advertisements
Similar presentations
LING/C SC/PSYC 438/538 Lecture 4 9/1 Sandiway Fong.
Advertisements

LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 3: 8/28.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 7: 9/11.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 2: 8/23.
ISBN Chapter 6 Data Types Character Strings Pattern Matching.
LING 388: Language and Computers Sandiway Fong Lecture 2: 8/23.
PERL Part 3 1.Subroutines 2.Pattern matching and regular expressions.
Tools for building compilers Clara Benac Earle. Tools to help building a compiler C –Lexical Analyzer generators: Lex, flex, –Syntax Analyzer generator:
W3101: Programming Languages (Perl) 1 Perl Regular Expressions Syntax for purpose of slides –Regular expression = /pattern/ –Broader syntax: if (/pattern/)
LING 388: Language and Computers Sandiway Fong Lecture 3: 8/28.
Comparing Numeric Values If Val(Text1.Text) = MaxPrice Then (Is the current numeric value stored in the Text property of Text1 equal to the value stored.
LING/C SC/PSYC 438/538 Lecture 8 Sandiway Fong. Adminstrivia.
Variables and Expressions
LING/C SC/PSYC 438/538 Lecture 5 9/8 Sandiway Fong.
Regular Expression A regular expression is a template that either matches or doesn’t match a given string.
Regular Expressions in ColdFusion Applications Dave Fauth DOMAIN technologies Knowledge Engineering : Systems Integration : Web.
Lecture 7: Perl pattern handling features. Pattern Matching Recall =~ is the pattern matching operator A first simple match example print “An methionine.
System Programming Regular Expressions Regular Expressions
Programming Perl in UNIX Course Number : CIT 370 Week 4 Prof. Daniel Chen.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 4: 8/30.
Chapter 10 Selected Single-Row Functions Oracle 10g: SQL.
RegExp. Regular Expression A regular expression is a certain way to describe a pattern of characters. Pattern-matching or keyword search. Regular expressions.
LING/C SC/PSYC 438/538 Lecture 2 Sandiway Fong. Today’s Topics Did you read Chapter 1 of JM? – Short Homework 2 (submit by midnight Friday) Today is Perl.
LING 388: Language and Computers Sandiway Fong Lecture 6: 9/15.
Agenda Regular Expressions (Appendix A in Text) –Definition / Purpose –Commands that Use Regular Expressions –Using Regular Expressions –Using the Replacement.
Regular Expression Dr. Tran, Van Hoai Faculty of Computer Science and Engineering HCMC Uni. of Technology
Oracle 11g: SQL Chapter 10 Selected Single-Row Functions.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 24 The String Section.
CS346 Javascript -3 Module 3 JavaScript Variables.
Working with Forms and Regular Expressions Validating a Web Form with JavaScript.
Pattern Matching CSCI N321 – System and Network Administration.
Appendix A: Regular Expressions It’s All Greek to Me.
Chapter 1 – Tools of Algebra
Strings and Patterns in Perl Ellen Walker Bioinformatics Hiram College.
Regular Expressions CS 2204 Class meeting 6 Created by Doug Bowman, 2001 Modified by Mir Farooq Ali, 2002.
LING/C SC/PSYC 438/538 Lecture 8 Sandiway Fong. Adminstrivia Homework 4 not yet graded …
JavaScript III ECT 270 Robin Burke. Outline Validation examples password more complex Form validation Regular expressions.
LING/C SC/PSYC 438/538 Lecture 14 Sandiway Fong. Administrivia Homework 6 graded.
CGS – 4854 Summer 2012 Web Site Construction and Management Instructor: Francisco R. Ortega Chapter 5 Regular Expressions.
Substituting into expressions.
LING/C SC/PSYC 438/538 Lecture 6 Sandiway Fong. Homework 4 Submit one PDF file Your submission should include code and sample runs Due date Monday 21.
Interpolation Variable Interpolation, Backslash Interpolation.
8 1 String Manipulation CGI/Perl Programming By Diane Zak.
Chapter 23 The String Section (String Manipulation) Clearly Visual Basic: Programming with Visual Basic nd Edition.
Regular Expressions.
PROGRAMMING THE BASH SHELL PART III by İlker Korkmaz and Kaya Oğuz
Chapter 12 Section 1.
Chapter 10 Selected Single-Row Functions Oracle 10g: SQL
Lecture 19 Strings and Regular Expressions
Perl-Compatible Regular Expressions Part 1
Regular Expressions in Perl
Letters.
LING/C SC/PSYC 438/538 Lecture 4 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 8 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 7 Sandiway Fong.
Programming Language Syntax 2
LING/C SC/PSYC 438/538 Lecture 10 Sandiway Fong.
CSCI 431 Programming Languages Fall 2003
LING/C SC/PSYC 438/538 Lecture 12 Sandiway Fong.
LING 408/508: Computational Techniques for Linguists
Variables and Expressions
LING/C SC/PSYC 438/538 Lecture 13 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 11 Sandiway Fong.
EASY SUBSTITUTION.
Algebra Substitution a = 3 ; b = 4 and c = -1 2a + c b2 – a2 2b2
To Start: 15 Points Evaluate: * 6 – 2 3(6 +2) – 2 3{6 +(3 * 4)}
Evaluating an expression with two variable
LING/C SC/PSYC 438/538 Lecture 8 Sandiway Fong.
Evaluating an expression with one variable
LING/C SC/PSYC 438/538 Lecture 12 Sandiway Fong.
Presentation transcript:

LING/C SC/PSYC 438/538 Online Lecture 7 Sandiway Fong

Homework Read textbook chapter 2, section 1 – Regular Expressions

Homework – Read up on the syntax of Perl Regular Expressions – Online tutorials

Perl Regular Expressions Perl regular expression (re) matching: – $a =~ /foo/ – /…/ contains a regular expression – will evaluate to true/false depending on what’s contained in $a Perl regular expression (re) match and substitute: – $a =~ s/foo/bar/ – s/…match… /…substitute… / contains two expressions – will modify $a by looking for a single occurrence of match and replacing that with substitute – s/…match… /…substitute… /g global match and substitute

Perl Regular Expressions Most useful with the code template for reading in a file line- by-line: open($txtfile,$ARGV[0]) or die "$ARGV[0] not found!\n"; while ($line = ) { do RE stuff with $line }

Perl Regular Expressions character class: Perl lingo

Perl Regular Expressions backslash lowercase letter for class Uppercase variant for all but class backslash lowercase letter for class Uppercase variant for all but class

Chapter 2: JM

Sheeptalk

Chapter 2: JM

Perl Regular Expressions Precedence of operators – Example: Column 1 Column 2 Column 3 … – /Column [0-9]+ */ – /(Column [0-9]+ *)*/ – /house(cat(s|)|)/ Perl: – in a regular expression the pattern matched by within the pair of parentheses is stored in designated variables $1 (and $2 and so on) Precedence Hierarchy: space