I want to do pattern matching using java.
My string is (a<b)
I tried with the following patterns.
[(][a][<][b][)]$
and
[(][a][/<][b][)]$
but these patterns doesn't match.
can any one tell me how to match operators like < , >, <=, >=, + ..
Thank u..
|
Team Leader
|
![]() |
| 2Apr2007,12:33 | #2 |
|
Try this
Code:
\([a]<[b]\) |
|
Newbie Member
|
|
| 2Apr2007,13:44 | #3 |
|
if(String.matches("\([a]<[b]\")
I am getting error: unrecognized escape sequence. |
|
Go4Expert Founder
|
![]() |
| 2Apr2007,13:56 | #4 |
|
You have not copied the things correctly. You are missing the end bracket.
|
|
Newbie Member
|
|
| 2Apr2007,14:06 | #5 |
|
After that also, I am getting the same error
if(strng.matches("\([a]<[b]\)") |
|
Team Leader
|
![]() |
| 2Apr2007,16:39 | #6 |
|
Here's an example of using Regular Expressions in Java
Code: Java
|
|
Newbie Member
|
|
| 2Apr2007,17:46 | #7 |
|
Thank u sir. It's working.
|
|
Light Poster
|
|
| 1May2007,21:20 | #8 |
|
Hi
I need to check for a PO Box addresses in a string. I should not allow a pobox in a address Line. For that I need a pattern and willl match this pattern with my string Ex:***** something like this ****** Pattern poBoxPattern = Pattern.compile("\\bp\\s*\\d") .... Matcher matcher = poBoxPattern.matcher(locationAddressStreet); if(matcher.find()){ } So, could anyone help me with making the pattern. My pattern should recognize sub strings like... 1. po 123 ( meaning: po followed by any integer/integers ) 2. p o 123 3. p.o. 123 4. p. o. 123 5. po box 6. po box 7. p o box 8. p o 123 Note: "po sometext" or "p o sometext" should not be recognized. Any help is truly appreciated. Thanks Sai |
|
Go4Expert Founder
|
![]() |
| 1May2007,21:29 | #9 |
|
sssrsl, have a separate thread for the query as that will give more visibility to experts as well as help others to search.
|
|
Light Poster
|
|
| 1May2007,21:38 | #10 |
|
I did. Thanks, for the suggestion.
|


