Sundeep Agarwal - Ruby Regexp
Here you can read online Sundeep Agarwal - Ruby Regexp full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2020, genre: Children. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:
Romance novel
Science fiction
Adventure
Detective
Science
History
Home and family
Prose
Art
Politics
Computer
Non-fiction
Religion
Business
Children
Humor
Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.
- Book:Ruby Regexp
- Author:
- Genre:
- Year:2020
- Rating:3 / 5
- Favourites:Add to favourites
- Your mark:
- 60
- 1
- 2
- 3
- 4
- 5
Ruby Regexp: summary, description and annotation
We offer to read an annotation, description, summary or preface (depends on what the author of the book "Ruby Regexp" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.
Ruby Regexp — read online for free the complete book (whole text) full work
Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Ruby Regexp" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.
Font size:
Interval:
Bookmark:
Sundeep Agarwal
Scripting and automation tasks often need to extract particular portions of text from input data or modify them from one format to another. This book will help you learn Regular Expressions, a mini-programming language for all sorts of text processing needs.
The book heavily leans on examples to present features of regular expressions one by one. It is recommended that you manually type each example and experiment with them. Understanding both the nature of sample input string and the output produced is essential. As an analogy, consider learning to drive a bike or a car no matter how much you read about them or listen to explanations, you need to practice a lot and infer your own conclusions. Should you feel that copy-paste is ideal for you, code snippets are available chapter wise on GitHub.
You should have prior experience working with Ruby, should know concepts like blocks, string formats, string methods, Enumerable, etc.
If you have prior experience with a programming language, but new to Ruby, check out my GitHub repository on Ruby Scripting before starting this book. That repository also includes a chapter on Regular Expressions which has been edited and expanded to create this book.
- The examples presented here have been tested with Ruby version 2.7.1 and includes features not available in earlier versions.
- Code snippets shown are copy pasted from
irb --simple-prompt
shell and modified for presentation purposes. Some commands are preceded by comments to provide context and explanations. Blank lines have been added to improve readability.nil
return value is not shown forputs
statements. Error messages are shortened. And so on. - Unless otherwise noted, all examples and explanations are meant for ASCII characters.
- External links are provided for further reading throughout the book. Not necessary to immediately visit them. They have been chosen with care and would help, especially during re-reads.
- The Ruby_Regexp repo has all the code snippets and files used in examples and exercises and other details related to the book. If you are not familiar with
git
command, click the Code button on the webpage to get the files.
- ruby-lang documentation manuals and tutorials
- /r/ruby/ and /r/regex/ helpful forum for beginners and experienced programmers alike
- stackoverflow for getting answers to pertinent questions on Ruby and regular expressions
- tex.stackexchange for help on
pandoc
andtex
related questions - Cover image:
- draw.io
- tree icon by Gopi Doraisamy under Creative Commons Attribution 3.0 Unported
- wand icon by roundicons.com
- Warning and Info icons by Amada44 under public domain
- softwareengineering.stackexchange and skolakoda for programming quotes
Special thanks to Allen Downey, an attempt at translating his book Think Python to Think Ruby gave me the confidence to publish my own book.
I would highly appreciate if you'd let me know how you felt about this book, it would help to improve this book as well as my future attempts. Also, please do let me know if you spot any error or typo.
Issue Manager: https://github.com/learnbyexample/Ruby_Regexp/issues
Goodreads: https://www.goodreads.com/book/show/48641238-ruby-regexp
E-mail:
Twitter: https://twitter.com/learn_byexample
Sundeep Agarwal is a freelance trainer, author and mentor. His previous experience includes working as a Design Engineer at Analog Devices for more than 5 years. You can find his other works, primarily focused on Linux command line, text processing, scripting languages and curated lists, at https://github.com/learnbyexample. He has also been a technical reviewer for Command Line Fundamentals book and video course published by Packt.
List of books: https://learnbyexample.github.io/books/
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License
Code snippets are available under MIT License
Resources mentioned in Acknowledgements section above are available under original licenses.
2.5
See Version_changes.md to track changes across book versions.
Regular Expressions is a versatile tool for text processing. You'll find them included as part of standard library of most programming languages that are used for scripting purposes. If not, you can usually find a third-party library. Syntax and features of regular expressions vary from language to language. Ruby's offering is based upon the Onigmo regular expressions library.
The String
class comes loaded with variety of methods to deal with text. So, what's so special about regular expressions and why would you need it? For learning and understanding purposes, one can view regular expressions as a mini programming language in itself, specialized for text processing. Parts of a regular expression can be saved for future use, analogous to variables and functions. There are ways to perform AND, OR, NOT conditionals. Operations similar to range and string repetition operators and so on.
Here's some common use cases:
- Sanitizing a string to ensure that it satisfies a known set of rules. For example, to check if a given string matches password rules.
- Filtering or extracting portions on an abstract level like alphabets, numbers, punctuation and so on.
- Qualified string replacement. For example, at the start or the end of a string, only whole words, based on surrounding text, etc.
You are likely to be familiar with graphical search and replace tool, like the screenshot shown below from LibreOffice Writer. Match case, Whole words only, Replace and Replace All are some of the basic features supported by regular expressions.
Another real world use case is password validation. The screenshot below is from GitHub sign up page. Performing multiple checks like string length and the type of characters allowed is another core feature of regular expressions.
Here's some articles on regular expressions to know about its history and the type of problems it is suited for.
- The true power of regular expressions it also includes a nice explanation of what regular means in this context
- softwareengineering: Is it a must for every programmer to learn regular expressions?
- softwareengineering: When you should NOT use Regular Expressions?
- codinghorror: Now You Have Two Problems
- wikipedia: Regular expression this article includes discussion on regular expressions as a formal language as well as details on various implementations
The book introduces concepts one by one and exercises at the end of chapters will require only the features introduced until that chapter. Each concept is accompanied by multiple examples to cover various angles of usage and corner cases. As mentioned before, follow along the illustrations by typing out the code snippets manually. It is important to understand both the nature of the sample input string as well as the actual programming command used. There are two interlude chapters that give an overview of useful external resources and some more resources are collated in the final chapter.
Font size:
Interval:
Bookmark:
Similar books «Ruby Regexp»
Look at similar books to Ruby Regexp. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.
Discussion, reviews of the book Ruby Regexp and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.