Skip to main content

Introducing new learning courses and educational videos from Apress. Start watching

Extracting Data from Regex Matches

  • 716 Accesses

Abstract

When you use a regex to validate input, it is enough to know whether a given string matches the regex or not. In many other cases, we want to extract more data from the string and the regex match.

This is a preview of subscription content, access via your institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • DOI: 10.1007/978-1-4842-3228-6_5
  • Chapter length: 10 pages
  • Instant PDF download
  • Readable on all devices
  • Own it forever
  • Exclusive offer for individuals only
  • Tax calculation will be finalised during checkout
eBook
USD   29.99
Price excludes VAT (USA)
  • ISBN: 978-1-4842-3228-6
  • Instant PDF download
  • Readable on all devices
  • Own it forever
  • Exclusive offer for individuals only
  • Tax calculation will be finalised during checkout
Softcover Book
USD   37.99
Price excludes VAT (USA)

Notes

  1. 1.

    https://docs.perl6.org/type/Match.html

  2. 2.

    https://docs.perl6.org/type/Array

  3. 3.

    Early versions of Perl 6 created an array capture for all quantified captures, even with the ? quantifier. It confused most users.

  4. 4.

    This primality test is commonly attributed to Abigail, a prolific Perl hacker. See for example http://neilk.net/blog/2000/06/01/abigails-regex-to-test-for-prime-numbers/ .

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and Permissions

Copyright information

© 2017 Moritz Lenz

About this chapter

Verify currency and authenticity via CrossMark

Cite this chapter

Lenz, M. (2017). Extracting Data from Regex Matches. In: Parsing with Perl 6 Regexes and Grammars. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-3228-6_5

Download citation