?
Solved

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

Posted on 2003-03-07
9
Medium Priority
?
235 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
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 …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses
Course of the Month8 days, 23 hours left to enroll

765 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