java - Replace everything after last forward slash -


I am trying to extract everything after the previous forward slash in my URL. I wrote some Reggae which works in the Java Regex testers, but unfortunately not in my local code. Why there can be any insights in it, it will be appreciated. Right now my REEGex pattern, target string and desired output are as follows.

  Regular expression: "[^ /] * $" target string: / example / c / coffee 101 desired output: / example / c / cafè999  

Bare-bones java code:

  target = "/ example / c / coffee101"; Change = "cafè999"; Target.replaceFirst ("[^ /] * $", change);  

Thanks a lot!

You must assign a return to the string class in the string object in any way Does not change:

  target = Target.replaceFirst ("[^ /] * $", replaced);  

Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -