I need to use a replace function in Java:
string.replace(myString,"");
myString values are for example javascript:r(0), javascript:r(23), javascript:l(5) etc. Just number is always different and there is r or l letter. What’s the regular expression to match it? Thanks
I need to use a replace function in Java: string.replace(myString,); myString values are for
Share
(FIXED) The regex you want is
NOTE: The outer quotes aren’t really part of the regex; they are part of the Java string you pass to
Pattern.compileor directly toreplace.Here is a complete program you can try:
Here is another version of the above program that calls
replaceAlldirectly on the string instead of pre-compiling the pattern: