• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

using regex for substituting text

 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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,
 
Ranch Hand
Posts: 694
Mac OS X Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I believe that the following class might be helpful to you for work:

PropertyResourceBundle
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic