java - Remove string between characters -
java - Remove string between characters -
i remove everything(for chars {}$* \w+ ""
) between ;
, #
:
for illustration remove string:
input:
or(and(ca18*cb18);m10#;abzz/kld // remove ;m10#
output:
or(and(ca18*cb18);abzz/kld
i tried regular expression:
^[;]\w+([a-za-z0-9])[#]
however, not seem work recommendations?
solution updated question be:
// actual regex ;[{}$*\w"']+?#, escaping needed java: input.replaceall(";[{}$*\\w\"']+?#", "");
where can update character set between [] match actual requirements find more border cases..
if decided need black-list of characters instead, utilize look negated character set (^
within [], not confuse ^ @ start of regex, denotes origin of string):
;[^;#]+?#
java regex
Comments
Post a Comment