| 61 | | public function preg_match_all(pattern, text, ByRef matches) |
| 62 | | |
| 63 | | dim objRegexp, objMatches, aryResults() |
| 64 | | dim ii |
| 65 | | |
| 66 | | ' new regular expression |
| 67 | | set objRegexp = new RegExp |
| 68 | | with objRegexp |
| 69 | | .Pattern = pattern |
| 70 | | .IgnoreCase = true |
| 71 | | .Global = true |
| 72 | | end with |
| 73 | | |
| 74 | | ' all matches |
| 75 | | set objMatches = objRegexp.Execute(text) |
| 76 | | if objMatches.Count > 0 then |
| 77 | | ii = 0 |
| 78 | | for each item in objMatches |
| 79 | | redim preserve aryResults(ii + 1) |
| 80 | | Set aryResults(ii) = item.SubMatches |
| 81 | | ii = ii + 1 |
| 82 | | Response.Write(item.value & "<br />") |
| 83 | | next |
| 84 | | preg_match_all = true |
| 85 | | else |
| 86 | | preg_match_all = false |
| 87 | | end if |
| 88 | | |
| 89 | | set objRegexp = nothing |
| 90 | | set objMatches = nothing |
| 91 | | set objRegexp = nothing |
| 92 | | |
| 93 | | matches = aryResults |
| 94 | | |
| 95 | | end function |
| 96 | | |
| 97 | | |
| 98 | | public function file_get_contents(path) |
| 99 | | |
| 100 | | dim objFso, objText |
| 101 | | dim strContent |
| 102 | | |
| 103 | | Set objFso = Server.CreateObject("Scripting.FileSystemObject") |
| 104 | | |
| 105 | | if objFso.FileExists(path) then |
| 106 | | set objText = objFso.OpenTextFile(path, 1, false, -2) |
| 107 | | strContent = objText.ReadAll |
| 108 | | objText.Close |
| 109 | | set objText = nothing |
| 110 | | else |
| 111 | | ' error |
| 112 | | strContent = false |
| 113 | | end if |
| 114 | | |
| 115 | | set objFso = nothing |
| 116 | | file_get_contents = strContent |
| 117 | | |
| 118 | | end function |