Home > database >  Remove duplicate characters regular expression tool, please help modify. Thanks
Remove duplicate characters regular expression tool, please help modify. Thanks

Time:09-26

# import Java. Util. Regex. Matcher;
. '# import Java. Util. Regex Pattern;
'#/* *
'# *
'# *
'# * & lt; b> The class name: & lt;/b> RegexUtil
'# * & lt; b> Class description: the regular expression tools & lt;/b>
'# * & lt; b> Modified time: & lt;/b> Mar 27, 2010 10:46:46 AM
'# * & lt; b> Modify the remark: & lt;/b>
'# * @ version 1.0.0 & lt; Br/& gt;
'# *
'# */
'# public class RegexUtil {
'#/* *
'# *
'# * delRepeat
Remove duplicate characters' # * & lt; Br/& gt;
'# * @ param STR
'# * @ return
'# * String
'# * @ exception
'# * @ since 1.0.0
'# */
'# public static String delRepeat (String STR) {
'# if (STR==null) {
'# return null;
'#}
'# Pattern running p=Pattern.com (" ((. {1, 3}?) 2 \ \ {2}) ");
'# Matcher m=p. atcher (STR);
'# while (m. ind ()) {
'# System. Out. Println (" repeating characters: "+ m.g roup (2));
'# System. Out. Println (" the repetitive characters: "+ m.g roup (1));
'# STR=STR. Replace (m.g roup (1), m.g roup (2));
'#}
'# return STR;
'#}
'#
'# public static void main (String [] args) {
'# String STR="happy in who I am who I am who I am good is ha ha, we we we just who I am who I am who I am ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha";
'# System. Out. Println (delRepeat (STR));
'#}
'#}
'# to run the program output:
'# repetitive characters: who am I
'# the repetitive characters: who I am who I am who I am
The character '# repeat:
'# the repetitive characters: is
'# repetitive characters: we
'# the repetitive characters: we we we
'# repetitive characters: who am I
'# the repetitive characters: who I am who I am who I am
'# repetitive characters: ha
'# the repetitive characters: ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha
'# open happy heart, who is in my good is ha ha, we just who I am,



Please help to appeal the code instead of vbscript thanks

CodePudding user response:

LZ seemed to send the wrong places.

CodePudding user response:

PB section is quite lively, what card is sent to here

CodePudding user response:

PB can also, just to change the syntax
  • Related