Text Processing with JavaScript: Regular Expressions, Tools, and Techniques for Optimal Performance 🔍
Faraz K. Kelhini Pragmatic Bookshelf, The Pragmatic Programmers, 1, 2024
英语 [en] · PDF · 13.3MB · 2024 · 📘 非小说类图书 · 🚀/lgli/lgrs/zlib · Save
描述
You might think of regular expressions as the holy grail of text processing, but are you sure you aren't just shoehorning them in where standard built-in solutions already exist and would work better? JavaScript itself provides programmers with excellent methods for text manipulation, and knowing how and when to use them will help you write more efficient and performant code. From extracting data from APIs to calculating word counts and everything in between, discover how to pick the right tool for the job and make the absolute most of it every single time.
Whether you're a beginner or an advanced programmer, this up-to-date guide will save you a ton of time when dealing with text. With Text Processing with JavaScript, you'll find a collection of tiny programs, each demonstrating a string manipulation approach in JavaScript. You'll also focus squarely on the practical aspects of text processing with JavaScript - that is, what each technique is designed to accomplish and how to use it in your program.
Discover how to extract data from APIs and web pages, apply spelling corrections, convert and format currencies, and remove HTML tags from text. Learn to intersect tables, copy text to the clipboard, extract lists from text, and highlight sentences that contain a specific word. Find duplicate words and fix them automatically, modify a copy of an existing regex literal, match the beginning or end of a string, and remove all comments from JavaScript and HTML files with ease. Match non-ASCII words, calculate the word count of an article in any language, and more.
Become a JavaScript expert and master chef of text processing with this collection of hands-on and production-ready recipes.
备用文件名
lgrsnf/sanet.st_Text.Processing.with.JavaScript.pdf
备用文件名
zlib/no-category/Faraz K. Kelhini/Text Processing with JavaScript: Regular Expressions, Tools, and Techniques for Optimal Performance_94893555.pdf
备选标题
Designing Distributed Systems: Patterns and Paradigms for Scalable, Reliable Systems Using Kubernetes
备选作者
Brendan Burns
备用出版商
Pragmatic Programmers, LLC, The
备用出版商
O'Reilly Media, Incorporated
备用出版商
GLOBAL ENTERTAINMENT SRL
备用版本
United States, United States of America
备用版本
Italy, Italy
备用版本
1, PS, 2024
元数据中的注释
Publisher's PDF | Published: January 23, 2024 | NOTE: Book version: P1.0—December 2023
备用描述
Cover
Table of Contents
Acknowledgments
Preface
Who Is This Book For?
What You Should Know
What’s in This Book?
Online Resources
1. Part I: Text Processing with Built-in JavaScript Methods
Recipe 1. Determining If a Value Is a String with the typeof Operator
Recipe 2. Checking a String for Specific Words with includes()
Recipe 3. Matching the Beginning or End of a String with startsWith() and endsWith()
Recipe 4. Extracting Lists from Text with slice()
Recipe 5. Converting Color Names to Hexadecimal Values with the Canvas Element
Recipe 6. Adding Transparency to Hex Colors
Recipe 7. Removing HTML Tags from Text with DOMParser()
Recipe 8. Converting HTML Markup to HTML Entities with replaceAll()
Recipe 9. Intersecting HTML Tables with filter()
Recipe 10. Generating HTML Tables from an Array of Arrays
Recipe 11. Generating HTML Tables from an Array of Objects
Recipe 12. Displaying Tabular Data in Console with console.table()
Recipe 13. Formatting Dates with Intl.DateTimeFormat()
Recipe 14. Formatting Currencies with Intl.NumberFormat()
Recipe 15. Adding Thousand Separators to Numbers with Intl.NumberFormat()
Recipe 16. Creating Language-Sensitive Lists with Intl.ListFormat()
Recipe 17. Determining Letter Case with charAt()
Recipe 18. Counting Unicode Characters with Intl.Segmenter()
Recipe 19. Counting Words in a String with Intl.Segmenter()
Recipe 20. Counting the Number of a Specific Word with split()
Recipe 21. Equalizing Incompatible Characters with normalize()
Recipe 22. Copying Text to Clipboard with the Clipboard API
2. Part II: Text Processing with Regular Expressions
Recipe 23. Creating Your First Regular Expression
Recipe 24. Asserting the Start or End of a String with ^ and $
Recipe 25. Looking For Whole Words Only with the Word Boundary (\b)
Recipe 26. Matching One of Several Alternatives with the Vertical Bar (|)
Recipe 27. Matching One of Several Characters with the Character Class
Recipe 28. Matching a Range of Characters with Character Classes
Recipe 29. Repeating Part of a Regex with Quantifiers
Recipe 30. Treating Multiple Characters as a Single Unit with the Capturing Group
Recipe 31. Extracting a Matched Value with the Capturing Group
Recipe 32. Excluding Groups from Result with the Non-capturing Group
Recipe 33. Reading Groups with Ease Using Named Capturing Groups
Recipe 34. Using Special Replacement Patterns
Recipe 35. Taking Away the Special Meaning of Replacement Patterns
Recipe 36. Using a Function as the Replacement Pattern
Recipe 37. Escaping Metacharacters with the Backslash
Recipe 38. Creating Lazy Quantifiers with the Question Mark
Recipe 39. Global and Case-Insensitive Matching with the g and i Flags
Recipe 40. Generating Indices for Matches with the d Flag
Recipe 41. Forcing ^ and $ to Match at the Start and End of a Line with the m Flag
Recipe 42. Forcing . to Match Newline Characters with the s Flag
Recipe 43. Enabling Unicode Features with the u Flag
Recipe 44. Searching from a Specific Index with the y Flag
Recipe 45. Modifying an Existing Regex Literal
Recipe 46. Referencing a Matched String with the Backreference
Recipe 47. Testing a Pattern with the Positive Lookahead
Recipe 48. Testing a Pattern with the Negative Lookahead
Recipe 49. Testing a Pattern with the Positive Lookbehind
Recipe 50. Testing a Pattern with the Negative Lookbehind
Recipe 51. Matching Non-ASCII Numerals with the Unicode Property Escape
Recipe 52. Matching Non-ASCII Words with the Unicode Property Escape
Recipe 53. Matching Unicode Word Boundaries with the Unicode Property Escape
3. Part III: Mastering Text Processing in JavaScript
Recipe 54. Validating Email Addresses
Recipe 55. Validating Password Strength
Recipe 56. Validating Social Security Numbers
Recipe 57. Validating ZIP Codes
Recipe 58. Validating Canadian Postal Codes
Recipe 59. Removing Duplicate Lines
Recipe 60. Removing Duplicate Lines Separated by Other Lines
Recipe 61. Removing Duplicate Spaces
Recipe 62. Removing Duplicate Whitespaces
Recipe 63. Replacing Duplicate Whitespaces with the Same Type
Recipe 64. Extracting Text Enclosed in Double Quotes
Recipe 65. Extracting Text Enclosed in Single Quotes
Recipe 66. Escaping a String for Use in a Regex
Recipe 67. Striping Invalid Characters from Filenames
Recipe 68. Matching Floating-Point Numbers
Recipe 69. Matching Formatted Numbers with Thousand Separators
Recipe 70. Matching Nearby Words
Recipe 71. Highlighting Sentences Containing a Specific Word
Recipe 72. Highlighting Text in Real Time
Recipe 73. Converting Plain Text into HTML-Ready Markup
Wrapping Up
May I Request a Favor from You?
A1. What Is Unicode?
A2. Implementing Regex in JavaScript
test()
exec()
match()
matchAll()
search()
replace()
replaceAll()
split()
Conclusion
A3. Testing Regex with Specialized Tools
RegexPal
RegExr
Regex101
RegexBuddy
Regex Vis
A4. Regular Expression Cheat Sheet
Character Classes
Quantifiers
Boundary Assertions
Lookaround Assertions
Groups and Backreferences
Flags
Unicode Property Escapes
Index
– SYMBOLS –
– DIGITS –
– A –
– B –
– C –
– D –
– E –
– F –
– G –
– H –
– I –
– J –
– K –
– L –
– M –
– N –
– O –
– P –
– Q –
– R –
– S –
– T –
– U –
– V –
– W –
– X –
– Y –
– Z –
开源日期
2024-12-18
更多信息……
We strongly recommend that you support the author by buying or donating on their personal website, or borrowing in your local library.

🚀 快速下载

成为会员以支持书籍、论文等的长期保存。为了感谢您对我们的支持,您将获得高速下载权益。❤️

🐢 低速下载

由可信的合作方提供。 更多信息请参见常见问题解答。 (可能需要验证浏览器——无限次下载!)

所有选项下载的文件都相同,应该可以安全使用。即使这样,从互联网下载文件时始终要小心。例如,确保您的设备更新及时。
  • 对于大文件,我们建议使用下载管理器以防止中断。
    推荐的下载管理器:JDownloader
  • 您将需要一个电子书或 PDF 阅读器来打开文件,具体取决于文件格式。
    推荐的电子书阅读器:Anna的档案在线查看器ReadEraCalibre
  • 使用在线工具进行格式转换。
    推荐的转换工具:CloudConvertPrintFriendly
  • 您可以将 PDF 和 EPUB 文件发送到您的 Kindle 或 Kobo 电子阅读器。
    推荐的工具:亚马逊的“发送到 Kindle”djazz 的“发送到 Kobo/Kindle”
  • 支持作者和图书馆
    ✍️ 如果您喜欢这个并且能够负担得起,请考虑购买原版,或直接支持作者。
    📚 如果您当地的图书馆有这本书,请考虑在那里免费借阅。