Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Converting sed regex to Java regex

807589Aug 21 2008 — edited Aug 21 2008
I am new to reguler expressions.I have to write a regex which will do some replacements

If the input string is something like test:17038199556@test.com;value=abcd
when I apply the regex on it,this string should be changed to test:17038199556@replaceTest.com;value=replacedABC

I am trying to replace test.com and abcd with the values i have supplied...

The regex I have come up with is in sed

s/\(^.*@\)\(.*\)$/\1replaceTest.com;value=replacedABC/i

Now I am trying to get the regex in Java,I would think it will be something like (^.*@\)(.*\)$\1replaceTest.com;value=replacedABC

But not sure How i can test this.Any idea on how to make sure my java regex is valid and does the required replacements?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 18 2008
Added on Aug 21 2008
11 comments
1,826 views