My Account Log in

1 option

Regular expression puzzles and AI coding assistants : 24 puzzles solved by the author, with and without assistance from Copilot, ChatGPT and more / David Mertz.

O'Reilly Online Learning: Academic/Public Library Edition Available online

View online
Format:
Book
Author/Creator:
David, Mertz, author.
Language:
English
Subjects (All):
Regular expressions (Computer science).
Artificial intelligence--Computer programs.
Artificial intelligence.
Physical Description:
1 online resource (109 pages)
Edition:
[First edition].
Place of Publication:
Shelter Island, New York : Manning, [2023]
Summary:
Learn how AI-assisted coding using ChatGPT and GitHub Copilot can dramatically increase your productivity (and fun) writing regular expressions and other programs. Regular Expression Puzzles and AI Coding Assistants is the story of two competitors. On one side is David Mertz, an expert programmer and the author of the Web's most popular Regex tutorial. On the other are the AI powerhouse coding assistants, GitHub Copilot and OpenAI ChatGPT. Here's how the contest works: David invents 24 Regex problems he calls puzzles and shows you how to tackle each one. When he's done, he has Copilot and ChatGPT work the same puzzles. What they produce intrigues him. Which side is likelier to get it right? Which will write simple and elegant code? Which makes smarter use of lesser known Regex library features? Read the book to find out. David also offers AI best practices, showing how smart prompts return better results. By the end, you'll be a master at solving your own Regex puzzles, whether you use AI or not.
Contents:
Intro
inside front cover
Regular Expression Puzzles and AI Coding Assistants
Copyright
contents
front matter
preface
acknowledgments
about this book
Who should read this book
Obtaining the tools used in this book
Credits
liveBook discussion forum
about the author
about the cover illustration
1 The map and the territory
About regular expressions
Rise of the programming machines
Caveats
Intentional software development
As you read
2 Quantifiers and special sub-patterns
Puzzle 1 Wildcard scope
Author thoughts What will each pattern match?
AI thoughts CodingNet
Puzzle 2 Words and sequences
Author thoughts Think about what defines word boundaries
AI thoughts The transformator
Puzzle 3 Endpoint classes
Author thoughts Refine the regular expression to match what we want
AI thoughts Are friends electric?
Puzzle 4 A configuration format
Author thoughts Remember that shapes have edges
AI thoughts Notes from the Cyberdyne vault
Puzzle 5 The Human Genome
Author thoughts Remember the central dogma of molecular biology
AI thoughts Do androids dream of electric sheep?
3 Pitfalls and sand in the gears
Puzzle 6 Catastrophic backtracking
Author thoughts Try hard to avoid catastrophes
AI thoughts Technological singularity
Puzzle 7 Playing dominoes
Author thoughts Try to be more efficient than your first thought
AI thoughts A war with sticks and stones
Puzzle 8 Advanced dominoes
Author thoughts Thoughts about digrams are always pleasant thoughts
AI thoughts How many readers can pass the Turing Test?
Puzzle 9 Sensor art
Author thoughts Find a matching pattern, if possible
AI thoughts My mind is going
I can feel it
4 Creating functions using regexen
Puzzle 10 Reimplementing str.count().
Author thoughts How can a regex count the substring occurrences?
AI thoughts Extraordinary machine
Puzzle 11 Reimplementing str.count() (stricter)
Author thoughts Write a Python function with the restrictions given
AI thoughts The Horars of War
Puzzle 12 Finding a name for a function
Author thoughts Code is read far more often than it is written
AI thoughts There are two hard problems in computer science
Puzzle 13 Playing poker (Part 1)
Author thoughts Functions are a big help in larger programs
AI thoughts He can't read my poker face
Puzzle 14 Playing poker (Part 2)
Author thoughts Large buildings are built from small bricks
AI thoughts The society for preventing cruelty to humans
Puzzle 15 Playing poker (Part 3)
Author thoughts You better cheat, cheat, if you can't win
AI thoughts Someday machines will learn to count
Puzzle 16 Playing poker (Part 4)
Author thoughts You might risk identifying the "dead man's hand"
AI thoughts Free will is not free
Puzzle 17 Playing poker (Part 5)
Author thoughts Remember that three is more than two, but less than four
AI thoughts Counting to two
5 Easy, difficult, and impossible tasks
Puzzle 18 Identifying equal counts
Author thoughts Lateral thinking might help you find the answer
AI thoughts Hic sunt dracones
Puzzle 19 Matching before duplicate words
Author thoughts Find a pattern that will fulfill the requirement
AI thoughts Deep fakes in the Chomsky hierarchy
Puzzle 20 Testing an IPv4 address
Author thoughts Ask whether regexen are powerful enough for a problem
AI thoughts I want to be a machine
Puzzle 21 Matching a numeric sequence
Author thoughts Rule out the impossible to be left with the solution
AI thoughts Wheat and chessboards
Puzzle 22 Matching the Fibonacci sequence.
Author thoughts The Golden Spiral beautifully generalizes Fibonacci numbers
AI thoughts The fractal geometry of nature
Puzzle 23 Matching the prime numbers
Author thoughts Honor the fundamental theorem of arithmetic
AI thoughts Sense and nonsense
Puzzle 24 Matching relative prime numbers
Author thoughts Nothing is either true or false but thinking makes it so
AI thoughts Six impossible things before breakfast
6 Conclusions
Appendix. Learning to use regular expressions
What tools use regular expressions?
Matching patterns in text: The basics
Character literals
Escaped characters literals
Positional special characters
The "wildcard" character
Grouping regular expressions
Using groups for backreferences
Character classes
Complement operator
Alternation of patterns
The basic abstract quantifier
Matching patterns in text: Intermediate
More abstract quantifiers
Numeric quantifiers
Backreferences
Do not match more than you want to
Tricks for restraining matches
Tricks for restraining matches better
Comments on modification tools
A note on modification examples
A literal-string modification example
A pattern-match modification example
Modification using backreferences
Another warning on mismatching
Advanced regular expression extensions
About advanced features
Non-greedy quantifiers
Atomic grouping and possessive quantifiers
Pattern-match modifiers
Changing backreference behavior
Naming backreferences
Lookahead assertions
Lookbehind assertions
Making regular expressions more readable
index.
Notes:
Description based on print version record.
Includes index.
ISBN:
9781638351887
1638351880
9781633437814
1633437817
OCLC:
1373623486

The Penn Libraries is committed to describing library materials using current, accurate, and responsible language. If you discover outdated or inaccurate language, please fill out this feedback form to report it and suggest alternative language.

Find

Home Release notes

My Account

Shelf Request an item Bookmarks Fines and fees Settings

Guides

Using the Find catalog Using Articles+ Using your account