I have a string like :- String str="This 'is' really good work"; i want to find 'is' . What should be the regex for this ?
Joined: Aug 05, 2005
Do you have to use regex ? str.indexOf("'is'") will do what you want.
Joined: Jun 01, 2007
The regex for 'is' is "'is'".
Joined: Feb 25, 2006
If it's the actual String "is" you're looking for, a simple indexOf(...) will do just fine, as already suggested. If you want to capture text between ' (single quote), here's a way to do that:
Joined: May 06, 2004
That regex is more complicated than it needs to be, Piet--or at least, more advanced. The OP didn't even mention needing to extract the word from within the apostrophes, but if you really need to, using capturing groups is simpler: