![]() the “b” wants to match a “b”, the “o” an “o”, etc. ![]() In bob, all three characters are literal, i.e. Regular expressions (referred to as “regex” for short) have both literal characters and meta characters. I might recommend at least reading Chapter 1. Nevertheless, we’ll just have a basic introduction to them this week and learn more advanced technique as we explore different text processing applications over the course of the semester.Ī truly wonderful book written on the subject is: Mastering Regular Expressions by Jeffrey Friedl. We could spend the entire semester studying regular expressions if we put our mind to it. The following is a rather rudimentary introduction to the basics of regular expressions. For example, the sequence bob, considered as a regular expression, would match any occurance of the word “bob” inside of another text. In addition, the regular expressions chapter in Eloquent JavaScript is more comprehensive than below.Ī regular expression is a sequence of characters that describes or matches a given amount of text. Hopefully, this will provide some of the basics to get you started, but to really understand regular expressions, I suggest you to read as much of Mastering Regular Expressions by Jeffrey E.F. It would be absurd to try to fully cover the topic in a short handout like this. WARNING: This is a woefully incomplete overview of regular expressions. Create a regex that matches only code comments in code.Adapt the regex tester to be a search/replace tester.Create an example that reads an HTML page and removes any markup and leaves only the raw content.Take that regular expression and do a search and replace so that any e-mail address is made into a “mailto:” link.Write a regular expression that matches any e-mail address.RegExr – a regular expressions playground.regexplained - a tool to visualize a regular expression.Eloquent JavaScript Regular Expressions.Chapter 1, Mastering Regular Expressions.Random Expression Generator - source code, thanks to randexp.js.Doubling the vowels using replace - source code.Regex basics with live ACE editor - source code.Loading file now loads into textarea - source code.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |