• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Regex

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone tell gud book or resouce for regex?
I wanna validate string for particular patterns

following are some of them
1) We have different types of strings like number (Year) followed by string

E.g Balance sheet (€m) 2006 2007 2008 2009e 2010e 2011e

"e"is of intrest but should be followed by numbers (years) e.g above 2009e
i use replaceAll like
tempLine=tempLine.replaceAll("[^0-9 eE]", "").trim();

tempLine containing "Balance sheet (€m) 2006 2007 2008 2009e 2010e 2011e "


2) "1Q/08", 4Q/08 - number "Q" slash followed by number(year)

how can we chk something followed/ preceded by something ?


 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In that case i would use Kathy Sierra & Bert Bates....
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lesson: Regular Expressions from Sun's Java Tutorials
Using Regular Expressions in Java
Java Regular Expression Test Page

Also have a look at the API documentation of the java.util.regex package.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!