Since I am not very clear about the positive, I would like to take the string "str, DGK, RDJK, DJKL,DGK, end" to replace "str, MSN, RDJK, djkl,msn, End"
To find a matching type of wording.
<script language= "VBScript" > <!--Dim str,reg str= "str, DGK, RDGK, DGKL,DGK, end" Set reg=new REGEXP Reg. Ignorecase=false Reg. Global=true Reg. Pattern= "([\s|,]) (DGK) ([\s|,])" Str= (Reg.replace (str, "$1msn$3")) document.write (str)//--> </SCRIPT>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
<script language= "VBScript" > Dim stringexample stringexample = "str, DGK, RDGK, DGKL,DGK, end" Set re = New Rege XP Re. Pattern = "(\b) dgk (\b)" Re. Global = True Re. IgnoreCase = True Re. MultiLine = True Stringexample = Re. Replace (Stringexample, "$1msn$2") Alert Stringexample </script>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
<script language= "JavaScript" > var stringexample = "str, DGK, RDGK, dgkl,dgk, End"; var re =/(\b) dgk (\b)/gi; Here the G means multiple matches, equivalent to vbscript Re.global = True stringexample = stringexample.replace (Re, "$1msn$2"); Alert (stringexample) </script>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
<script language= "JavaScript" > var stringexample = "str, DGK, RDGK, dgkl,dgk, End"; var re =/(\b) dgk (\b)/gi stringexample = Stringexample.replace (re,function (s,a,b) {alert ([a,b])}) </script>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]