JavaScript Regular Expressions
暫譯: JavaScript 正則表達式

Loiane Groner, Gabriel Manricks

  • 出版商: Packt Publishing
  • 出版日期: 2015-06-01
  • 售價: $1,670
  • 貴賓價: 9.5$1,587
  • 語言: 英文
  • 頁數: 112
  • 裝訂: Paperback
  • ISBN: 1783282258
  • ISBN-13: 9781783282258
  • 相關分類: JavaScript
  • 海外代購書籍(需單獨結帳)

商品描述

Leverage the power of regular expressions to create an engaging user experience

About This Book

  • Build and use patterns in JavaScript to solve real-world problems
  • Simplify complex validation processes by mastering the pattern language in Regex
  • A step-by-step guide along with a lot of real-world examples to manipulate text and crunch data, in URLs, paths, markup, and so on

Who This Book Is For

This book is ideal for JavaScript developers and programmers who work with any type of user entry data and want sharpen their skills to become experts.

What You Will Learn

  • Structure your patterns and model different types of constraints
  • Clean and optimize code with Regex's processing power
  • Solve common use cases and situations
  • Extract different types of fields correctly
  • Embed regular expressions both in your UI and on the backend
  • Efficiently create guard clauses in your functions using patterns
  • Create blank capture groups to handle inconsistent data
  • Capture parts of a pattern in a group to display, replace, or use character sets to match characters

In Detail

Regular expressions are patterns or templates that allow you to define a set of rules in a natural yet vague way, giving you the ability to match and validate text. Therefore, they have been implemented in nearly every modern programming language. JavaScript's implementation allows us to perform complex tasks with a few lines of code using regular expressions to match and extract data out of text.

This book starts by exploring what a pattern actually is and how regular expressions express these patterns to match and manipulate user data. You then move on to learning about the use of character classes to define a wild character match, a digit match, and an alphanumeric match. You will then learn to manipulate text and shorten data in URLs, paths, markup, and data exchange, as well as other advanced Regex features.

Finally, you will work through real-world examples, both in the browser and on the server side using Node.js.

商品描述(中文翻譯)

利用正則表達式的力量來創造引人入勝的用戶體驗

關於本書


  • 在 JavaScript 中建立和使用模式以解決現實世界的問題

  • 通過掌握 Regex 的模式語言簡化複雜的驗證過程

  • 提供逐步指南以及大量現實世界的範例,以操作文本和處理數據,包括 URL、路徑、標記等

本書適合誰

本書非常適合 JavaScript 開發人員和處理任何類型用戶輸入數據的程式設計師,想要提升技能成為專家的讀者。

您將學到什麼

  • 結構化您的模式並建模不同類型的約束
  • 利用 Regex 的處理能力清理和優化代碼
  • 解決常見的使用案例和情境
  • 正確提取不同類型的字段
  • 在您的用戶界面和後端嵌入正則表達式
  • 使用模式有效地在您的函數中創建保護條件
  • 創建空的捕獲組以處理不一致的數據
  • 捕獲模式的一部分到一個組中以顯示、替換或使用字符集來匹配字符

詳細內容

正則表達式是允許您以自然但模糊的方式定義一組規則的模式或模板,使您能夠匹配和驗證文本。因此,它們幾乎在每種現代編程語言中都有實現。JavaScript 的實現使我們能夠使用幾行代碼執行複雜的任務,利用正則表達式來匹配和提取文本中的數據。

本書首先探討模式的實際含義以及正則表達式如何表達這些模式以匹配和操作用戶數據。接著,您將學習使用字符類來定義通配符匹配、數字匹配和字母數字匹配。然後,您將學習在 URL、路徑、標記和數據交換中操作文本和縮短數據,以及其他高級 Regex 功能。

最後,您將通過現實世界的範例進行實作,無論是在瀏覽器中還是在使用 Node.js 的伺服器端。