aspose file tools*
The moose likes Java in General and the fly likes Java Regular Expression help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java Regular Expression help" Watch "Java Regular Expression help" New topic
Author

Java Regular Expression help

Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
Calling all regEx gurus.

Here is a string -



I'd like to use Java Regex classes to extract the followign strings

/RenderData/RequestData/Row[Name='rdoAddAn']/Value='O'
/RenderData/RequestData/Row[Name='sClientType']/Value = 'O'
/RenderData/ErrorData/Error
/RenderData/ProcessData/cadfr/invalidCityStateZipCombination


Much appreciated!
[ February 06, 2006: Message edited by: Ajith Kallambella ]

Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
This should get you started:

[ February 06, 2006: Message edited by: Lasse Koskela ]

Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
Thank you Lasse. You're da man!!
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
I'd probably make that more generic:

"\\s+(((or)|(and)|(not))\\s+)*";

I think it also reads better...


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Java Regular Expression help