• Post Reply Bookmark Topic Watch Topic
  • New Topic

Regular Expressions  RSS feed

 
Aliya Khamzieva
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
Can anybody recommend a good book to expand my understanding of regular expressions?
I have been programming in Java and I have a basic understanding of regex but I encountered a task that required to write a regex for binary numbers divisible by 3. The task required understanding of Finite State Automation.
I was not familiar with the concept at all so I will really appreciate some advice to how to tackle this concept to get better at regular expressions.

 
Campbell Ritchie
Sheriff
Posts: 55351
157
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A rather old book but try Lex and Yacc by Levine Mason and Brown (O'Reilly). I think it has (long time since I looked) about 30 pages about regexes, and the rest is about compilers. But Lex uses regexes to identify tokens for the compiler.

I might be able to give you a PDF free because I mistakenly bought two copies of it.

Not a Java9 question: moving to the general Java forum.
 
Aliya Khamzieva
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your response.
I would really appreciate if you could share the PDF with me.

 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37181
515
Eclipse IDE Java VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I like Mastering Regular Expressions. It helped me gain a really detailed understanding of how regex processing works.  Most regex books are "old" because it isn't a topic that is changed. Java added regex in Java 1.4 and they work the same way. So no need to keep updating the book.

Your expercise sounds like an academic one. In the real world, you'd just use a regex to pull the numbers out of a string and then use "%3" to determine if they are divisible by 3.
 
Aliya Khamzieva
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your answer.
Maybe I am overthinking it)
 
John Carlos
Greenhorn
Posts: 28
2
Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne Boyarsky wrote:I like Mastering Regular Expressions.

+1 on this book.  This is the book I read and now pretty much wherever I go I become known as "the regex guy" and co-workers seek my help.  You may be over-thinking this particular task, but knowing regex is a handy tool to have in your toolbox, especially when in separates you from the crowd.
 
Aliya Khamzieva
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got the book. Looks good. Thanks to everybody for the responses.
I really appreciate it.
 
Campbell Ritchie
Sheriff
Posts: 55351
157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You probably don't need my book any more, then.
 
Aliya Khamzieva
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would not mind having it anyway. But regardless thank very much for the offer.
 
Campbell Ritchie
Sheriff
Posts: 55351
157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have sent you the pdf of the book (); I think there is less in it about regexes than I thought. If you don't want to keep it, please delete the pdf and inform me within one week.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!