Read without ads and support Scribd by becoming a Scribd Premium Reader.
 
 
Regular Expressions
The Complete Tutorial Jan Goyvaerts
 
 
Regular Expressions: The Complete Tutorial
 Jan Goyvaerts
Copyright © 2006 Jan Goyvaerts. All rights reserved.No part of this book shall be reproduced, stored in a retrieval system, ortransmitted by any means, electronic, mechanical, photocopying, recording, orotherwise, without written permission from the author.Every effort has been made to make this book as complete and as accurate aspossible, but no warranty or fitness is implied. The information is provided on an“as is” basis. The author and the publisher shall have neither liability norresponsibility to any person or entity with respect to any loss or damages arising from the information contained in this book.First printing: February 2006
 
 i
 Table of Contents
 Tutorial..........................................................................1
 
1. Regular Expression Tutorial..............................................................................3
 
2. Literal Characters................................................................................................6
 
3. First Look at How a Regex Engine Works Internally...................................9
 
4. Character Classes or Character Sets...............................................................11
 
5. The Dot Matches (Almost) Any Character...................................................16
 
6. Start of String and End of String Anchors...................................................19
 
7. Word Boundaries..............................................................................................24
 
8. Alternation with The Vertical Bar or Pipe Symbol......................................26
 
9. Optional Items...................................................................................................28
 
10. Repetition with Star and Plus........................................................................30
 
11. Use Round Brackets for Grouping..............................................................34
 
12. Named Capturing Groups.............................................................................40
 
13. Unicode Regular Expressions.......................................................................43
 
14. Regex Matching Modes..................................................................................49
 
15. Atomic Grouping and Possessive Quantifiers...........................................51
 
16. Lookahead and Lookbehind Zero-Width Assertions...............................58
 
17. Testing The Same Part of a String for More Than One Requirement...63
 
18. Continuing at The End of The Previous Match........................................66
 
19. If-Then-Else Conditionals in Regular Expressions...................................68
 
20. Adding Comments to Regular Expressions...............................................70
 
Examples.....................................................................71
 
1. Sample Regular Expressions...........................................................................73
 
2. Matching Floating Point Numbers with a Regular Expression.................75
 
3. How to Find or Validate an Email Address.................................................77
 
4. Matching a Valid Date......................................................................................82
 
5. Matching Whole Lines of Text.......................................................................84
 
6. Deleting Duplicate Lines From a File............................................................86
 
8. Find Two Words Near Each Other...............................................................88
 
Search History:
Searching...
Result 00 of 00
00 results for result for
  • p.
  • Notes
    Load more