How to cheat at Scrabble An intro to regular expressions

Slides:



Advertisements
Similar presentations
Regular Expression Original Notes by Song Guo. What Regular Expressions Are Exactly - Terminology a regular expression is a pattern describing a certain.
Advertisements

ISBN Regular expressions Mastering Regular Expressions by Jeffrey E. F. Friedl –(on reserve.
 Just the word will find too many instances  Searching for blanks on both sides loses start and end  How to solve? › See last Thursday examples.
Regular Expressions 101 Danny Bryant City of Atlanta.
Modern Information Retrieval Chapter 4 Query Languages.
Regular expression. Validation need a hard and very complex programming. Sometimes it looks easy but actually it is not. So there is a lot of time and.
Lecture 6 29/1/15. Number functions Number functions take numbers as input, change them, and output the results as numbers. 2.
Filters using Regular Expressions grep: Searching a Pattern.
Regular Expression A regular expression is a template that either matches or doesn’t match a given string.
Last Updated March 2006 Slide 1 Regular Expressions.
MORE APPLICATIONS OF REGULAR EXPRESSION By Venkata Sai Pundamalli id:
Overview Classes of datatypes available in Oracle 10g – Character – Numeric – Long, Raw – Dates/Times – Large Objects (LOBs) – ROWID – Specialized 1.
Data Mining Douglas C. Atkins, OCP FASTER Staff: 1998 – 2010.
Pattern matching with regular expressions A common file processing requirement is to match strings within the file to a standard form, e.g. address.
Methods in Computational Linguistics II with reference to Matt Huenerfauth’s Language Technology material Lecture 4: Matching Things. Regular Expressions.
Chapter 10 Selected Single-Row Functions Oracle 10g: SQL.
1 University of Palestine Topics In CIS ITBS 3202 Ms. Eman Alajrami 2 nd Semester
+ 9.1 Zero and Negative Exponents. + Warm Up: Complete the tables by finding the value of each power.
8 Copyright © 2006, Oracle. All rights reserved. Regular Expression Support.
Patterns and Functions
Oracle 11g: SQL Chapter 10 Selected Single-Row Functions.
Post-Module JavaScript BTM 395: Internet Programming.
Database Programming Sections 13–Creating, revoking objects privileges.
Regular Expressions – An Overview Regular expressions are a way to describe a set of strings based on common characteristics shared by each string in.
An introduction to permutations
Introduction to Access 2010 CIS120first.accdb is the database I am creating.
2# BLAST & Regular Expression Searches Functionality Susie Stephens Life Sciences Product Manager Oracle Corporation.
Regular Expressions in Perl CS/BIO 271 – Introduction to Bioinformatics.
Regular Expressions What is this line all about? while (!($search =~ /^\s*$/)) { It’s a string search just like before, but with a huge twist – regular.
©Brooks/Cole, 2001 Chapter 9 Regular Expressions ( 정규수식 )
©Brooks/Cole, 2001 Chapter 9 Regular Expressions.
With Doug Atkins Getting Data Out of FASTER: Tips for the New & Experienced.
CSC 4630 Meeting 21 April 4, Return to Perl Where are we? What is confusing? What practice do you need?
May 2008CLINT-LIN Regular Expressions1 Introduction to Computational Linguistics Regular Expressions (Tutorial derived from NLTK)
Copyright © Curt Hill Regular Expressions Providing a Search Pattern.
CIT 383: Administrative ScriptingSlide #1 CIT 383: Administrative Scripting Regular Expressions.
CompSci 101 Introduction to Computer Science November 18, 2014 Prof. Rodger.
Validation using Regular Expressions. Regular Expression Instead of asking if user input has some particular value, sometimes you want to know if it follows.
Using SQL in PL/SQL Oracle Database PL/SQL 10g Programming Chapter 4.
CGS – 4854 Summer 2012 Web Site Construction and Management Instructor: Francisco R. Ortega Chapter 5 Regular Expressions.
Standard Types and Regular Expressions CS 480/680 – Comparative Languages.
7 Copyright © 2009, Oracle. All rights reserved. Regular Expression Support.
Chapter 4 © 2009 by Addison Wesley Longman, Inc Pattern Matching - JavaScript provides two ways to do pattern matching: 1. Using RegExp objects.
Algebra Pinkston Example of proportion: A package of 15 tablets sells for $1.17. At the same rate, how much would a bottle of 100 tablets cost?
-Joseph Beberman *Some slides are inspired by a PowerPoint presentation used by professor Seikyung Jung, which was derived from Charlie Wiseman.
Pattern Matching: Simple Patterns. Introduction Programmers often need to scan a file, directory, etc. for a specific substring. –Find all files that.
Regular Expressions. What is it 4? Text searching & replacing Sequence searching (input, DNA) Sequence Tracking Machine Operation logic machines that.
Gollis University Faculty of Computer Engineering Chapter Five: Retrieval, Functions Instructor: Mukhtar M Ali “Hakaale” BCS.
May 2006CLINT-LIN Regular Expressions1 Introduction to Computational Linguistics Regular Expressions (Tutorial derived from NLTK)
CompSci 101 Introduction to Computer Science April 7, 2015 Prof. Rodger.
Understanding Regular Expressions – Peter Robson – Finnish OUG Helsinki, April JustSQL.com Understanding Regular Expressions Peter Robson Technical.
Lesson 4 String Manipulation. Lesson 4 In many applications you will need to do some kind of manipulation or parsing of strings, whether you are Attempting.
Hands-on Regular Expressions Simple rules for powerful changes.
Regular Expressions 'RegEx'.
Introducing Oracle Regular Expressions
Looking for Patterns - Finding them with Regular Expressions
Oracle 10g & 11g for Dev Virtual Columns DML error logging
Chapter 10 Selected Single-Row Functions Oracle 10g: SQL
Variables and Data Types
Look(ahead|behind) Assertions
Welcome to Enlightenment Speed Dating!
Copyright © 2007 Training Games, Inc.
Game Mediums Intro D4.
CIT 383: Administrative Scripting
Introduction to Access 2010
Database terminology Plus sorting and searching Traffic lights quiz Hold up the coloured card that matches the correct answer you see on the screen.
For First Place Most Times Up at the Table
- Regular expressions:
Regular Expressions.
What We Want To Do User enters: Mary Smith
Presentation transcript:

How to cheat at Scrabble An intro to regular expressions

Who is Brian Rawlings? Data Architect @ Intermountain Healthcare Database professional since 1994 B.S. degree in Computer Science NOT an Oracle employee NOT selling anything twitter.com/BrianRawlings

Pattern Matching Scrabble is played by forming letter tiles into patterns Data can be like scrabble tiles Regular expressions are used to match patterns Learning to cheat at Scrabble can help you query data

Dictionary Table CREATE TABLE TRAIN.WORD_LIST ( WORD VARCHAR2(50 BYTE) ); Table populated with a dictionary from the internet. Various sets are available.

Concept: REGEXP Functions LIKE Very simple pattern matching REGEXP_LIKE Does a pattern exist REGEXP_COUNT How many times does a pattern exist Other Functions REGEXP_REPLACE – Search and Replace REGEXP_SUBSTR – Returns a substring REGEXP_INSTR – Returns the position

Start Simple Use “Like” to find words starting with ‘M’ Like ‘%melt’ SELECT * FROM train.word_list WHERE word like 'M%'; Like ‘%melt’ Like ‘%melt%’

Limitations of LIKE I've got four Ts. What words can I make with four Ts? I've got a Q but no U. What words have a Q not followed by a U? What words can I make with these 7 letters?

Start of a word Use REGEXP_LIKE to find words starting with ‘M’ SELECT * FROM train.word_list WHERE regexp_like(word, '^M'); ^ represents the start of a word

Concept: Anchors Anchors allow you to specify where a match is allowed ^ Beginning of the string $ End of a string

End of a word Use REGEXP_LIKE to find words ending with ‘MELT’ SELECT * FROM train.word_list WHERE regexp_like(word,'MELT$'); $ represents the end of a word

Concept: Dot What if there is only room for one character? SELECT * FROM train.word_list WHERE regexp_like (word, '^.MELT$'); ‘.’ represents one character

Quiz How many two letter words are in the training dictionary? How many two letter words start with Q? How many words end with Q? How many four letter words start with “T” end in “R”?

Concept: REGEX_COUNT Show words that have at least four Ts? SELECT * FROM train.word_list WHERE regexp_count(word, 'T') >= 4

Concept: Character Class[] List words ending in a 'q' or a 'u' SELECT * FROM train.word_list WHERE regexp_like(word, '[qu]$');

Concept: Repetition List the words can be made with only the letters A and N SELECT * FROM train.word_list WHERE regexp_like(word, '^[AN]+$') The + means repeat this pattern 1 or more times

Anagrams How many words can you make from the letters that make up your name? SELECT word FROM train.word_list WHERE regexp_like (word,'^[BRIAN]+$') [] brackets create a set + plus mean set repeat set one or more times

Anagrams How many words can you make from the letters that make up your name only once? SELECT word FROM train.word_list WHERE regexp_like(word, '^[BRIAN]+$') AND regexp_count(word, 'B') <= 1 AND regexp_count(word, 'R') <= 1 AND regexp_count(word, 'I') <= 1 AND regexp_count(word, 'A') <= 1 AND regexp_count(word, 'N') <= 1

Scrabble Scramble Scrabble equivalent to “Best Ball” in golf Everyone plays at the same time Use queries to find your best answer 60 seconds between rounds Score your best word. Write down your score on the side of paper Best score will choose next tiles. Compare your best against the group best

Questions I created this presentation. You are welcome to use this presentation to train your own team. But if you would like to package it and sell it for millions of dollars, let's talk. Twitter.com/BrianRawlings