• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

regular expression

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all

Is there a method available in any of the java packages which will replace a expression with a different one in the source string.

Can I use Regular Expressions for this ?

Any more information will be highly appreciated

Thanks
 
Ranch Hand
Posts: 442
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by kishore goswami:
Hi all

Is there a method available in any of the java packages which will replace a expression with a different one in the source string.

Can I use Regular Expressions for this ?

Any more information will be highly appreciated

Thanks



Hi, some more info will have helped point you to either the String class or the regex package, if it's fairly basic stuff then go have a look at the String class, in fact look anyway, methods like replace/replaceFirst/replaceAll specifically, there's also matches and regionMatches that may be of use.
If String is lacking move on to the regex package
 
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

unfortunatelly java.util.regex and regexp support in Strings
has been in only since 1.4. If you need your soft to work with
older JREs you can use jakarta regexp (google it).

Best regards,
Petr
 
This looks like a job for .... legal tender! It says so right in this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic