wood burning stoves 2.0*
The moose likes Java in General and the fly likes Regular Expression Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Regular Expression" Watch "Regular Expression" New topic

Regular Expression

Udaya Wijenayake
Ranch Hand

Joined: May 15, 2009
Posts: 30
I have a text like this.

I want a regular expression that is match to every word related to car. Eg. Car, cars, CAR, car.

SCJP 1.5
David Newton

Joined: Sep 29, 2008
Posts: 12617

What have you tried so far?
fred rosenberger
lowercase baba

Joined: Oct 02, 2003
Posts: 11170

do you want to match words like "Oscar" or "baccarat"? One of the tricks is that you have to first know and define what you do want, and what you don't want. A list of examples does not define that, as they don't account for all possible cases.

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Udaya Wijenayake
Ranch Hand

Joined: May 15, 2009
Posts: 30
No, I want only car and cars ignoring case.
Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3023

Udaya Wijenayake wrote:No, I want only car and cars ignoring case.

David Newton wrote:What have you tried so far?

Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
I agree. Here's the link: http://aspose.com/file-tools
subject: Regular Expression
Similar Threads
questions regarding regular expressions
PrimeFaces / JSF questions
High Gas Prices
bad using method get()
variable in place of object?