JavaScript Regular Expressions

Loiane Groner, Gabriel Manricks

  • 出版商: Packt Publishing
  • 出版日期: 2015-06-01
  • 售價: $1,640
  • 貴賓價: 9.5$1,558
  • 語言: 英文
  • 頁數: 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建立並使用模式來解決現實世界的問題
- 通過掌握正則表達式中的模式語言,簡化複雜的驗證過程
- 提供逐步指南以及大量的現實世界範例,用於操作文本和處理數據,包括URL、路徑、標記等等

本書適合對象
- 本書適合JavaScript開發人員和程式設計師,他們處理各種類型的使用者輸入數據,並希望提升自己的技能成為專家。

你將學到什麼
- 結構化你的模式並建立不同類型的約束
- 使用正則表達式的處理能力來清理和優化代碼
- 解決常見的使用情境和問題
- 正確提取不同類型的字段
- 在UI和後端中都能有效地嵌入正則表達式
- 使用模式來高效地創建函數的守衛條件
- 創建空白捕獲組以處理不一致的數據
- 在模式中捕獲部分以顯示、替換或使用字符集來匹配字符

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

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

最後,您將通過在瀏覽器和使用Node.js的服務器端進行真實世界的範例來進一步學習。