aspose file tools
The moose likes Java in General and the fly likes using regex for substituting text Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "using regex for substituting text" Watch "using regex for substituting text" New topic
Author

using regex for substituting text

Mohit Sinha
Ranch Hand

Joined: Nov 29, 2004
Posts: 125
Hi there,

I am in the midst of developing placeholder evaluation utility where in I have a properties file
with values something like
--------------------
category=classification
home=residence
work=office
--------------------
The values in the left hand side are the ones I receive in input and I need to replace the same with values in the
right hand side.
So the input to my routine could be something like this "The %category is invalid for %home or %work" and I need to replace these with its resourcebundle equivalent as mentioned above.
The purpose of this special character identifier (% in this case)is to indicate these are in a way placeholders and candidate for substitution.

I believe using regex in this scenario would be appropriate.

Can you post your thoughts on going about the same.

Thanks,
Kaydell Leavitt
Ranch Hand

Joined: Nov 18, 2006
Posts: 682

I believe that the following class might be helpful to you for work:

PropertyResourceBundle
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: using regex for substituting text
 
Similar Threads
String problem
Highlight the search keyword
Regex Help Needed
Generate a string that matches a regular expression
urgent help--- fileformatting