I have a string
/bus-stops/
Can anyone help me with a regex to remove escape slashes and provide only the string?
myString.replaceAll("\\\\/","");
Try this regex:
(?<=/)[^/]+(?=/)
This will match slash delimited characters (without including the slashes)
java
tag Here's how to use a simpler regex in java:
String input = "foo/bus-stops/bar";
String token = input.replaceAll(".*/([^/]+)/.*", "$1");
System.out.println(token); // prints "bus-stops"
This will remove your all escape slashes from string
str.replaceAll("\\\\\\\\","");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.