1. Trang chủ
  2. » Công Nghệ Thông Tin

Apress java regular expressions taming the java dot util dot regex engine sep 2008 ISBN 1590591070

368 209 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 368
Dung lượng 1,57 MB

Nội dung

Java Regular Expressions: Taming the java.util.regex Engine ISBN:1590591070 by Mehran Habibi Apress © 2004 (256 pages) This book is a valuable reference for learning about regular expressions in Java, and focuses on the use of regular expressions in the Java language Table of Contents Java Regular Expressions—Taming the java.util.regex Engine Introduction Chapter 1 - Regular Expressions Introduction to the Java.util.regex Object Chapter 2 Model Chapter 3 - Advanced Regex Chapter 4 - Object-Oriented Regex Chapter 5 - Practical Examples Appendix A - Regular Expression Reference Appendix B - Pattern and Matcher Methods Appendix C - Common Regex Patterns Index List of Figures List of Tables List of Listings and Outputs List of Sidebars Back Cover Java has always been an excellent language for working with objects But Java’s text manipulation mechanisms have always been limited, compared to languages like AWK and Perl On the flip side, a new regular expressions package in Java 2 Standard Edition (J2SE) brings hope to the Java text mechanisms This package provides you everything necessary to use regular expressions—all packaged in a simplified object-oriented framework In addition to working examples and best practices, this book features a detailed API reference with examples supporting nearly every method, and a stepby-step tutorial to create your own regular expressions With time, you’ll discover that regular expressions are extremely powerful in your programming arsenal—and you’ll enjoy using them! And once you’ve mastered these tools, you’ll ponder how you ever managed without them About the Author Mehran Habibi is the coauthor of The Sun Certified Java Developer Exam with J2SE 1.4 and Cracking the AP Computer Science Exam, 2004-2005 Edition He is also an application architect with BankOne in Ohio, where he resides with his lovely wife, Angela Mehran has over 9 years of IT experience, including positions with IBM, Executive Jet, UUNET, BankOne, and OCLC, in addition to working as a university lecturer, independent consultant, and Java certification trainer Technologies of interest to him include web services, wireless technologies, and XML/XSLT Mehran's professional focus has been on architecture, project leadership, mentoring, team leadership, and programming from the mid-tier on back Mehran holds certifications in both "The Other Company" and Java 2, and he graduated with a bachelor's of science degree in software engineering from the honors program at The Ohio State University Java Regular Expressions—Taming the java.util.regex Engine MEHRAN HABIBI Copyright © 2004 by Mehran Habibi All rights reserved No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher ISBN (pbk): 1-59059-107-0 Printed and bound in the United States of America 12345678910 Trademarked names may appear in this book Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark Technical Reviewer: Bill Saez Editorial Board: Steve Anglin, Dan Appleman, Gary Cornell, James Cox, Tony Davis, John Franklin, Chris Mills, Steven Rycroft, Dominic Shakeshaft, Julian Skinner, Jim Sumser, Karen Gavin Wray, John Zukowski Assistant Publisher: Grace Wong Project Manager: Nate McFadden Copy Editor: Nicole LeClerc Production Manager: Kari Brooks Production Editor: Laura Cheu Proofreader: Linda Seifert Compositor: Susan Glinert Stevens Indexer: Kevin Broccoli Artist: Kinetic Publishing Services, LLC Cover Designer: Kurt Krames Manufacturing Manager: Tom Debolski Distributed to the book trade in the United States by Springer-Verlag New York, Inc., 175 Fifth Avenue, New York, NY, 10010 and outside the United States by Springer-Verlag GmbH & Co KG, Tiergartenstr 17, 69112 Heidelberg, Germany In the United States: phone 1-800-SPRINGER, email , or visit http://www.springerny.com Outside the United States: fax +49 6221 345229, email , or visit http://www.springer.de For information on translations, please contact Apress directly at 2560 Ninth Street, Suite 219, Berkeley, CA 94710 Phone 510-549-5930, fax 510-549-5939, email , or visit http://www.apress.com The information in this book is distributed on an "as is" basis, without warranty Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work The source code for this book is available to readers at http://www.apress.com in the Downloads section You will need to answer questions pertaining to this book in order to successfully download the code This book is dedicated to my lovely wife, Angela Young, MD I must have been really, really good in a previous life About the Author Mehran Habibi is the coauthor of The Sun Certified Java Developer Exam with J2SE 1.4 (Apress, 2003) and Cracking the AP Computer Science Exam, 2004-2005 Edition (Princeton Review, 2004) He is also an application architect with BankOne in Ohio, where he resides with his lovely wife, Angela Mehran has over nine years of IT experience, including positions with IBM, Executive Jet, UUNET, BankOne, and OCLC, in addition to working as a university lecturer, independent consultant, and Java certification trainer Technologies of interest to him include Web services, wireless technologies, and XML/XSLT Mehran's professional focus has been on architecture, project leadership, mentoring, team leadership, and programming from the mid-tier on back Mehran holds certifications in both "The Other Company" and Java 2, and he graduated with a bachelor's of science degree in software engineering from the honors program at The Ohio State University Mehran is an amateur boxer, teaches martial arts at The Ohio State University, enjoys soccer, and has ruined his chess by playing too many speed games You can contact him at About the Technical Reviewer Bill Saez is a software engineer with Motorola in Ft Lauderdale, Florida While working with Motorola, Bill helped to create the world's first Javapowered wireless handset with J2ME and CLDC certification in 2000 Since then, he has continued to play an integral part in the commercialization and development of the J2ME platform and has authored several OEM APIs for iDEN handsets as well as J2ME Developer Guides for those products Bill has been involved with Java development since its introduction and even served as a guinea pig for The Ohio State University's experimental Java software courses He received his bachelor's degree in software engineering from The Ohio State University and is currently pursuing a master's degree in computer science from the University of Florida When he's not working or studying, Bill enjoys training for and running marathons, traveling with his family, and infrequently writing game reviews (http://www.epinions.com/user-billservo) in his copious spare time Acknowledgments I'd like to thank Nate McFadden, Gary Cornell, Nicole LeClerc, and Laura Cheu from Apress for being such a joy to work with I'd also like to acknowledge the strong contributions of various friends, including Terry Camerlengo, the excellent people at JavaRanch (http://www.javaranch.com), and various kind others who provided feedback and suggestions In particular, I'm grateful for Jim Yingst's fine critical eye I would also like to acknowledge the strong mathematical analysis provided by my father, Dr Javad Habibi Last but certainly not least, I'd like to thank my technical reviewer, Bill Saez, for an amazing technical eye and a very gentle style I can't wait to see your book there, Bill Introduction The fundamental goal of any computer language is the manipulation of data Traditionally, Java has been an excellent language for doing so, provided that the data is represented as objects However, Java's raw data manipulation mechanisms have always been somewhat lacking, especially when compared to the powerful machinations offered by languages such as Perl and awk The introduction of a standard regular expression package into Java 2 Standard Edition (J2SE) is an excellent step in rectifying this oversight The java.util.regex package offers developers everything they need to use regular expressions in Java, all packaged in an easy-to-use, object-oriented structure I think that you'll find that the java.util.regex package can become an extremely powerful tool in your programming arsenal, as well an elegant instrument that you'll enjoy using After you've mastered it, you will wonder, as I did, how you ever managed without it What this Book is About This book is a comprehensive introduction to the regular expression support built into J2SE, and it's designed to help Java programmers who have little to no experience with regular expressions It's meant to be both a reference and an explanatory text Although a background in regular expressions is helpful, I don't make any such assumptions when presenting the material The central aim is to help everyday programmers solve everyday problems After reading this text, you should be able to solve a great many of your routine text validation, searching, modification, and replacement problems quickly and efficiently by using Java's built-in regular expression support Of course, this book also covers some advanced features of regular expressions You should to be able to effectively use your new understanding of regular expressions as soon as you finish Chapter 1 Who Should Read this Book If you're new to regular expressions, but you're comfortable with the Java language, then this book is intended for you If you have a background in regular expressions, but you need a reference for Java's regular expression package, you'll also find this book useful However, if you're new to Java, you may find that you're better served by reading some introductory texts first There are scores of good introductory books available, though my recommendations are Head First Java by Kathy Sierra and Bert Bates (O'Reilly & Associates, 2003) and Thinking in Java, Third Edition by Bruce Eckel (Prentice Hall, 2002) You can't go wrong with either book ... and he graduated with a bachelor's of science degree in software engineering from the honors program at The Ohio State University Java Regular Expressions Taming the java. util. regex Engine MEHRAN HABIBI Copyright © 2004 by Mehran Habibi All rights reserved... Chapter 1 is a natural starting point if you're new to regular expressions in J2SE or if you need a refresher on regular expressions in general Chapter 2 Chapter 2 introduces the built-in Java support for regular expressions through the Pattern and Matcher classes... The introduction of a standard regular expression package into Java 2 Standard Edition (J2SE) is an excellent step in rectifying this oversight The java. util. regex package offers developers everything they need to use regular expressions in Java, all packaged in an easy-to-use,

Ngày đăng: 26/03/2019, 17:13

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN