Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

how i will get a tabkey while parsing  the key  ??

Posted on 2003-03-07
9
Medium Priority
?
240 Views
Last Modified: 2010-03-31
hi,

I  ned to search for an expression inside a string .
e.q i need to search for "o_errortext := " in the following string .

     o_errortext     := 'A card cannot contain itself.';

i am using a regular expression like
             if( str.matches("(?i).*o_errortext *:=.*"))

  but here , if there is "TAB" in between, I  am not able to recognise it.
Can you please tellme how to capture "TAB" in java ??
0
Comment
Question by:tridev
8 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 400 total points
ID: 8090059
\s.*?

in between will allow for whitespace
0
 

Expert Comment

by:danBosh
ID: 8090360
\t, i think?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 8090447
From API docs:

>>\s A whitespace character: [ \t\n\x0B\f\r]<<
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:hj2k3
ID: 8091950
you are specifying space in the regular expression:

 if( str.matches("(?i).*o_errortext *:=.*"))

it should be

 if( str.matches("(?i).*o_errortext*:=.*"))

if there was just a tab it wouldn't have worked unless there was a space and a tab
0
 
LVL 1

Expert Comment

by:hj2k3
ID: 8091961
...although CEHJ is right, \s would be better becuase it would only allow whitespace, so

 if( str.matches("(?i).*o_errortext\s:=.*"))

(i think)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 8093608
Sorry dan - an error that came to me just as i was going to sleep last night!

>>\s.*?

should have been

>>\s*?

(quite a different thing ;-))
0
 

Expert Comment

by:CleanupPing
ID: 9058852
tridev:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 35

Expert Comment

by:girionis
ID: 9687128
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- Points to CEHJ

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

girionis
EE Cleanup Volunteer
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses
Course of the Month15 days, 15 hours left to enroll

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question