|
1 members (Russ),
10,950
guests, and
1,516
robots. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
S |
M |
T |
W |
T |
F |
S |
|
|
|
1
|
2
|
3
|
4
|
5
|
|
6
|
7
|
8
|
9
|
10
|
11
|
12
|
|
13
|
14
|
15
|
16
|
17
|
18
|
19
|
|
20
|
21
|
22
|
23
|
24
|
25
|
26
|
|
27
|
28
|
29
|
30
|
31
|
|
|
|
|
This is another custom island. This one could be used for ads. This spot is one of the best places for ads on your site to be placed. This can be enabled/disabled on a per forum basis.
|
|
|
|
Joined: Dec 1999
Posts: 30,868
Master Elite Member
|
Str_Replace(Str, Find, Replace, Flags)
Str_Replace = function(Str, Find, Replace, Flags) {
/*
Purpose
Used to replace a specified string with another string.
Parameters
Str (string) = The string were operating on.
Find (string) = The string we're searching for.
Replace (string) = The string we're replacing Find with.
Flags (optional string) = Determines how the replace is performed.
This is a character string that is sent to the RegExp(Flags) parameter.
Some valid valids:
"g" Perform a global replace. All instances of Find are replaced.
"i" Perform a case-insensitive replace.
Default if falsey: "g"
Return (string)
Returns a string with Find replaced with Replace.
Version History
1.0 2015.12.06 Tested by Russ Tanner.
*/
// Default parameters
Flags = Flags || 'g';
// Escape the Find string so any special characters can be used.
FindEscaped = Find.replace(/[-[\]{}()*+!<=:?.\/\\^$|#\s,]/g, '\\$&');
// Perform the replacement and return the result.
var re = new RegExp(FindEscaped, Flags);
return Str.replace(re, Replace);
}
Last edited by Russ; 12/06/15 07:44 PM.
|
|
|
|
|