• Complain

Sundeep Agarwal - JavaScript RegExp

Here you can read online Sundeep Agarwal - JavaScript 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.

No cover

JavaScript RegExp: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "JavaScript RegExp" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

JavaScript RegExp is one of many books oriented to teach you how to learn and write Regex commands for JS, Ruby and Python, as well as linux tools such as Awk, sed and grep.This books is part of the Awesome Regex collection by learnbyexample. https://gumroad.com/l/regex?recommended_by=library

Sundeep Agarwal: author's other books


Who wrote JavaScript RegExp? Find out the surname, the name of the author of the book and a list of all author's works by series.

JavaScript 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 "JavaScript 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.

Light

Font size:

Reset

Interval:

Bookmark:

Make
JavaScript RegExp
JavaScript RegExp

Sundeep Agarwal

Preface

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 as implemented in JavaScript. Regular expressions can be considered as a mini-programming language in itself and is well suited for a variety 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.

Prerequisites

A good understanding of basic-level programming concepts and prior experience working with JavaScript. Should also know functional programming concepts like map and filter.

Conventions
  • The examples presented here have been tested on Chrome/Chromium console (version 81+) and includes features not available in other browsers and platforms.
  • Code snippets shown are copy pasted from the console and modified for presentation purposes. Some of the commands are preceded by comments to provide context and explanations. Blank lines have been added to improve readability and output is skipped when it is undefined or otherwise unnecessary to be shown.
  • 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 rereads.
  • The learn_js_regexp repo has all the code snippets and exercises and other details related to the book. Click the Clone button to get the files.
Acknowledgements
  • MDN: Regular Expressions documentation and examples
  • /r/learnjavascript/ and /r/regex/ helpful forums for beginners and experienced programmers alike
  • stackoverflow for getting answers to pertinent questions on JavaScript and regular expressions
  • tex.stackexchange for help on pandoc and tex related questions
  • Cover image: LibreOffice Draw and regulex
  • Warning and Info icons by Amada44 under public domain
Feedback and Errata

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/learn_js_regexp/issues

Goodreads: https://www.goodreads.com/book/show/49090622-javascript-regexp

E-mail:

Twitter: https://twitter.com/learn_byexample

Author info

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/

License

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.

Book version

1.5

See Version_changes.md to track changes across book versions.

What's so special about Regular Expressions?

Regular Expressions is a versatile tool for text processing. You'll find them included in the 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. JavaScript's syntax is similar to that of Perl language, but there are significant feature differences.

The String object in JavaScript supports 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. There are ways to perform AND, OR, NOT conditionals. Operations similar to range and repetition 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 - photo 1

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.

Heres some articles on regular expressions to know about its history and the - photo 2

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
How this book is organized

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.

By the end of the book, you should be comfortable with both writing and reading regular expressions, how to debug them and know when to

Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «JavaScript RegExp»

Look at similar books to JavaScript 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.


Reviews about «JavaScript RegExp»

Discussion, reviews of the book JavaScript 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.