├── .gitattributes ├── .github └── FUNDING.yml ├── .gitignore ├── .gitmodules ├── .version ├── .vssbe ├── LICENSE ├── Readme.md ├── algo ├── Algorithms.cpp ├── Algorithms.h ├── Analyzer.cpp ├── Analyzer.h ├── EssAndExt.h ├── Meter.h ├── Readme.md ├── Util.h ├── algo.vcxproj ├── algo.vcxproj.filters ├── main.cpp ├── stdafx.cpp ├── stdafx.h ├── targetver.h └── typedefs.h ├── build.bat ├── changelog.txt ├── common.props ├── dotnetTest ├── ConariMatchTest.cs ├── ConariReplaceTest.cs ├── Properties │ └── launchSettings.json ├── _svc │ ├── EngineOptions.cs │ ├── InitTests.cs │ ├── MatchResult.cs │ └── TestHelper.cs └── dotnetTest.csproj ├── packages.config ├── regXwild.sln ├── regXwild ├── RXWVersion.h ├── conf.h ├── core │ ├── ESS │ │ ├── AlgorithmEss.cpp │ │ ├── AlgorithmEss.h │ │ ├── EngineOptions.h │ │ ├── LoopAct.h │ │ ├── MatchResult.h │ │ └── def.h │ └── EXT │ │ ├── AlgorithmExt.cpp │ │ └── AlgorithmExt.h ├── declspec.h ├── dllmain.cpp ├── regXwild.common.cpp ├── regXwild.common.h ├── regXwild.cpp ├── regXwild.h ├── regXwild.rc ├── regXwild.vcxproj ├── regXwild.vcxproj.filters ├── regXwildAPI.h ├── resource.h ├── stdafx.cpp ├── stdafx.h ├── targetver.h └── typedefs.h ├── regXwildTest ├── AlgorithmExtTest.cpp ├── EssANYSPTest.cpp ├── EssBeginEndTest.cpp ├── EssFlagICASETest.cpp ├── EssMatchTest.cpp ├── EssMixedTest.cpp ├── EssRangesTest.cpp ├── EssSamplesTest.cpp ├── EssSplitTest.cpp ├── regXwildTest.vcxproj ├── regXwildTest.vcxproj.filters ├── stdafx.cpp ├── stdafx.h └── targetver.h ├── snet ├── Algorithms.cs ├── Analyzer.cs ├── Meter.cs ├── Program.cs ├── Properties │ └── AssemblyInfo.cs ├── packages.config └── snet.csproj └── tools ├── gnt.bat ├── hMSBuild.bat ├── regXwild.dotnet.targets ├── regXwild.native.targets └── regXwild.nuspec /.gitattributes: -------------------------------------------------------------------------------- 1 | 2 | # Our batch files requires CRLF for correct work. 3 | # https://github.com/3F/hMSBuild/issues/2 4 | 5 | *.bat text eol=crlf 6 | *.cmd text eol=crlf 7 | *.tpl text eol=crlf -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # ____ 2 | # /___/|\ 3 | # `~|___| ! With open love to open source. 4 | # /___/ \; Yours, github.com/3F 5 | # 6 | 7 | ko_fi: github3f 8 | custom: ['3F.github.io/Donation/'] 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Specific 2 | 3 | # ... 4 | 5 | 6 | ## Ignore Visual Studio temporary files, build results, and 7 | ## files generated by popular Visual Studio add-ons. 8 | 9 | # User-specific files 10 | *.suo 11 | *.user 12 | *.userosscache 13 | *.sln.docstates 14 | 15 | # User-specific files (MonoDevelop/Xamarin Studio) 16 | *.userprefs 17 | 18 | # Build results 19 | [Dd]ebug/ 20 | [Dd]ebugPublic/ 21 | [Rr]elease/ 22 | [Rr]eleases/ 23 | [Xx]64/ 24 | [Xx]86/ 25 | [Bb]uild/ 26 | bld/ 27 | [Bb]in/ 28 | [Oo]bj/ 29 | 30 | # Visual Studio 2015 cache/options directory 31 | .vs/ 32 | # Uncomment if you have tasks that create the project's static files in wwwroot 33 | #wwwroot/ 34 | 35 | # MSTest test Results 36 | [Tt]est[Rr]esult*/ 37 | [Bb]uild[Ll]og.* 38 | 39 | # NUNIT 40 | *.VisualState.xml 41 | TestResult.xml 42 | 43 | # Build Results of an ATL Project 44 | [Dd]ebugPS/ 45 | [Rr]eleasePS/ 46 | dlldata.c 47 | 48 | # DNX 49 | project.lock.json 50 | artifacts/ 51 | 52 | *_i.c 53 | *_p.c 54 | *_i.h 55 | *.ilk 56 | *.meta 57 | *.obj 58 | *.pch 59 | *.pdb 60 | *.pgc 61 | *.pgd 62 | *.rsp 63 | *.sbr 64 | *.tlb 65 | *.tli 66 | *.tlh 67 | *.tmp 68 | *.tmp_proj 69 | *.log 70 | *.vspscc 71 | *.vssscc 72 | .builds 73 | *.pidb 74 | *.svclog 75 | *.scc 76 | 77 | # Chutzpah Test files 78 | _Chutzpah* 79 | 80 | # Visual C++ cache files 81 | ipch/ 82 | *.aps 83 | *.ncb 84 | *.opendb 85 | *.opensdf 86 | *.sdf 87 | *.cachefile 88 | *.VC.db 89 | 90 | # Visual Studio profiler 91 | *.psess 92 | *.vsp 93 | *.vspx 94 | *.sap 95 | 96 | # TFS 2012 Local Workspace 97 | $tf/ 98 | 99 | # Guidance Automation Toolkit 100 | *.gpState 101 | 102 | # ReSharper is a .NET coding add-in 103 | _ReSharper*/ 104 | *.[Rr]e[Ss]harper 105 | *.DotSettings.user 106 | 107 | # JustCode is a .NET coding add-in 108 | .JustCode 109 | 110 | # TeamCity is a build add-in 111 | _TeamCity* 112 | 113 | # DotCover is a Code Coverage Tool 114 | *.dotCover 115 | 116 | # NCrunch 117 | _NCrunch_* 118 | .*crunch*.local.xml 119 | nCrunchTemp_* 120 | 121 | # MightyMoose 122 | *.mm.* 123 | AutoTest.Net/ 124 | 125 | # Web workbench (sass) 126 | .sass-cache/ 127 | 128 | # Installshield output folder 129 | [Ee]xpress/ 130 | 131 | # DocProject is a documentation generator add-in 132 | DocProject/buildhelp/ 133 | DocProject/Help/*.HxT 134 | DocProject/Help/*.HxC 135 | DocProject/Help/*.hhc 136 | DocProject/Help/*.hhk 137 | DocProject/Help/*.hhp 138 | DocProject/Help/Html2 139 | DocProject/Help/html 140 | 141 | # Click-Once directory 142 | publish/ 143 | 144 | # Publish Web Output 145 | *.[Pp]ublish.xml 146 | *.azurePubxml 147 | 148 | # TODO: Un-comment the next line if you do not want to checkin 149 | # your web deploy settings because they may include unencrypted 150 | # passwords 151 | #*.pubxml 152 | *.publishproj 153 | 154 | # NuGet Packages 155 | *.nupkg 156 | # The packages folder can be ignored because of Package Restore 157 | **/packages/* 158 | # except build/, which is used as an MSBuild target. 159 | !**/packages/build/ 160 | # Uncomment if necessary however generally it will be regenerated when needed 161 | #!**/packages/repositories.config 162 | # NuGet v3's project.json files produces more ignoreable files 163 | *.nuget.props 164 | *.nuget.targets 165 | 166 | # Microsoft Azure Build Output 167 | csx/ 168 | *.build.csdef 169 | 170 | # Microsoft Azure Emulator 171 | ecf/ 172 | rcf/ 173 | 174 | # Microsoft Azure ApplicationInsights config file 175 | ApplicationInsights.config 176 | 177 | # Windows Store app package directory 178 | AppPackages/ 179 | BundleArtifacts/ 180 | 181 | # Visual Studio cache files 182 | # files ending in .cache can be ignored 183 | *.[Cc]ache 184 | # but keep track of directories ending in .cache 185 | !*.[Cc]ache/ 186 | 187 | # Others 188 | ClientBin/ 189 | [Ss]tyle[Cc]op.* 190 | ~$* 191 | *~ 192 | *.dbmdl 193 | *.dbproj.schemaview 194 | *.pfx 195 | *.publishsettings 196 | node_modules/ 197 | orleans.codegen.cs 198 | 199 | # RIA/Silverlight projects 200 | Generated_Code/ 201 | 202 | # Backup & report files from converting an old project file 203 | # to a newer Visual Studio version. Backup files are not needed, 204 | # because we have git ;-) 205 | _UpgradeReport_Files/ 206 | Backup*/ 207 | UpgradeLog*.XML 208 | UpgradeLog*.htm 209 | 210 | # SQL Server files 211 | *.mdf 212 | *.ldf 213 | 214 | # Business Intelligence projects 215 | *.rdl.data 216 | *.bim.layout 217 | *.bim_*.settings 218 | 219 | # Microsoft Fakes 220 | FakesAssemblies/ 221 | 222 | # GhostDoc plugin setting file 223 | *.GhostDoc.xml 224 | 225 | # Node.js Tools for Visual Studio 226 | .ntvs_analysis.dat 227 | 228 | # Visual Studio 6 build log 229 | *.plg 230 | 231 | # Visual Studio 6 workspace options file 232 | *.opt 233 | 234 | # Visual Studio LightSwitch build output 235 | **/*.HTMLClient/GeneratedArtifacts 236 | **/*.DesktopClient/GeneratedArtifacts 237 | **/*.DesktopClient/ModelManifest.xml 238 | **/*.Server/GeneratedArtifacts 239 | **/*.Server/ModelManifest.xml 240 | _Pvt_Extensions 241 | 242 | # LightSwitch generated files 243 | GeneratedArtifacts/ 244 | ModelManifest.xml 245 | 246 | # Paket dependency manager 247 | .paket/paket.exe 248 | 249 | # FAKE - F# Make 250 | .fake/ -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "Conari"] 2 | path = Conari 3 | url = https://github.com/3F/Conari.git 4 | -------------------------------------------------------------------------------- /.version: -------------------------------------------------------------------------------- 1 | 1.4.0 -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013-2021 Denis Kuzmin github/3F 4 | Copyright (c) regXwild contributors https://github.com/3F/regXwild 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. -------------------------------------------------------------------------------- /algo/Algorithms.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2013-2021 Denis Kuzmin github/3F 5 | * Copyright (c) regXwild contributors https://github.com/3F/regXwild 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | 26 | #pragma once 27 | 28 | #include "typedefs.h" 29 | 30 | namespace net { namespace r_eg { namespace regXwild 31 | { 32 | class Algorithms 33 | { 34 | public: 35 | 36 | /* candidates of main algorithm: */ 37 | 38 | bool findGetlineFind(const tstring& text, const tstring& filter); 39 | bool findIteratorFind(const tstring& text, const tstring& filter); 40 | bool findRegexpCpp11m(const tstring& text, const tregex& filter); 41 | bool findRegexpCpp11s(const tstring& text, const tregex& filter); 42 | bool findFindFind(const tstring& text, const tstring& filter); 43 | bool findIteratorSubstr(const tstring& text, const tstring& filter); 44 | bool findIteratorIterator(const tstring& text, const tstring& filter); 45 | 46 | /* draft of main algorithm: */ 47 | 48 | bool main(const tstring& text, const tstring& filter); 49 | void mainTest(); 50 | 51 | /* final implementations: */ 52 | 53 | bool finalEss(const tstring& data, const tstring& filter/*, bool ignoreCase*/); 54 | bool finalExt(const tstring& data, const tstring& filter); 55 | 56 | protected: 57 | 58 | void assertMainAny(); 59 | void assertMainSplit(); 60 | void assertMainOne(); 61 | }; 62 | 63 | }}} -------------------------------------------------------------------------------- /algo/Analyzer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2013-2021 Denis Kuzmin github/3F 5 | * Copyright (c) regXwild contributors https://github.com/3F/regXwild 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | 26 | #include "stdafx.h" 27 | #include "Analyzer.h" 28 | #include "Meter.h" 29 | #include "Util.h" 30 | 31 | namespace net { namespace r_eg { namespace regXwild { 32 | 33 | void Analyzer::calc(const string& label, refstr_t data, refstr_t filter, int iterations, talgo method, Algorithms& alg, int average) 34 | { 35 | Meter meter; 36 | int results = 0; 37 | 38 | for(int total = 0; total < average; ++total) 39 | { 40 | meter.start(); 41 | for(int i = 0; i < iterations; ++i) 42 | { 43 | if((alg.*method)(data, filter)) { 44 | //... 45 | } 46 | } 47 | results += meter.delta(); 48 | TRACE("."); 49 | } 50 | 51 | DELTAINFO(label, results / average); 52 | } 53 | 54 | void Analyzer::calc(const string& label, refstr_t data, refstr_t filter, int iterations, tralgo method, Algorithms& alg, int average) 55 | { 56 | Meter meter; 57 | int results = 0; 58 | 59 | meter.start(); 60 | 61 | auto rfilter = tregex( 62 | filter, 63 | regex_constants::icase | regex_constants::optimize 64 | ); 65 | 66 | results += meter.delta(); 67 | DELTAINFO("\n\t* +time to create basic_regex from filter (icase | optimize): ", results); 68 | TRACE("\t* "); 69 | 70 | for(int total = 0; total < average; ++total) 71 | { 72 | meter.start(); 73 | for(int i = 0; i < iterations; ++i) { 74 | if((alg.*method)(data, rfilter)) { } 75 | } 76 | results += meter.delta(); 77 | TRACE("."); 78 | } 79 | 80 | DELTAINFO(label, results / average); 81 | TRACE("\n"); 82 | } 83 | 84 | void Analyzer::calc() 85 | { 86 | tstring data = _T("#//Anime/Kyoto Animation/Clannad TV -/Suzumiya Haruhi/Lucky Star/Full Metal Panic Fumoffu/P.A. Works/Angel Beats!/A-1 Pictures/Ano Hi Mita Hana no Namae wo Bokutachi wa Mada Shira nai/Макото Синкай [2002] Kanojo to kanojo no neko/ Kino no Tabi @ ... World/White Fox/Врата Штайнера (Врата Штейна (Steins Gate))/SHAFT/Maho Shojo Madoka Magica"); //340 87 | tstring filter = _T("nime**haru*02*Magica"); 88 | int lim = 10000; 89 | 90 | tryAlgo(data, filter, lim, 30); 91 | tryRegex(data, filter, lim, 1); 92 | } 93 | 94 | void Analyzer::tryAlgo(refstr_t data, refstr_t filter, int iterations, int average) 95 | { 96 | int lim = iterations; 97 | Algorithms alg; 98 | 99 | TRACE(lim << " x " << average << "\n"); 100 | 101 | calc(" Find + Find: ", data, filter + _T("*"), lim, &Algorithms::findFindFind, alg, average); 102 | calc(" Iterator + Find: ", data, filter, lim, &Algorithms::findIteratorFind, alg, average); 103 | calc(" Getline + Find: ", data, filter, lim, &Algorithms::findGetlineFind, alg, average); 104 | calc(" Iterator + Substr: ", data, filter + _T("*"), lim, &Algorithms::findIteratorSubstr, alg, average); 105 | calc(" Iterator + Iterator: ", data, filter + _T("*"), lim, &Algorithms::findIteratorIterator, alg, average); 106 | calc(" main :: based on Iterator + Find: ", data, filter, lim, &Algorithms::main, alg, average); 107 | 108 | TRACE("\n-----------\n"); 109 | 110 | calc(" Final algorithm - EXT version: ", data, filter, lim, &Algorithms::finalExt, alg, average); 111 | calc(" Final algorithm - ESS version: ", data, filter, lim, &Algorithms::finalEss, alg, average); 112 | 113 | TRACE("-----------\n"); 114 | } 115 | 116 | void Analyzer::tryRegex(refstr_t data, refstr_t filter, int iterations, int average) 117 | { 118 | int lim = iterations; 119 | Algorithms alg; 120 | 121 | TRACE("\n" << lim << " x " << average << "\n"); 122 | TRACE("The regex engine is much more slower (~30-90sec for 10000 iterations), please wait... \n\n"); 123 | 124 | TRACE("regexp-c++11(regex_search): "); 125 | calc(" ", data, Util::strReplace((tstring)_T("*"), (tstring)_T(".*"), filter), lim, &Algorithms::findRegexpCpp11s, alg, average); 126 | 127 | TRACE("regexp-c++11(only as ^match$ like a simple '=='): "); 128 | calc(" ", data, Util::strReplace((tstring)_T("*"), (tstring)_T(".*"), filter), lim, &Algorithms::findRegexpCpp11m, alg, average); 129 | 130 | TRACE("regexp-c++11(regex_match with endings .*): "); 131 | calc(" ", data, _T(".*") + Util::strReplace((tstring)_T("*"), (tstring)_T(".*"), filter) + _T(".*?"), lim, &Algorithms::findRegexpCpp11m, alg, average); 132 | } 133 | 134 | }}} -------------------------------------------------------------------------------- /algo/Analyzer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2013-2021 Denis Kuzmin github/3F 5 | * Copyright (c) regXwild contributors https://github.com/3F/regXwild 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | 26 | #pragma once 27 | 28 | #include "typedefs.h" 29 | #include "Algorithms.h" 30 | 31 | namespace net { namespace r_eg { namespace regXwild 32 | { 33 | typedef bool(Algorithms::*talgo)(refstr_t, refstr_t); 34 | typedef bool(Algorithms::*tralgo)(refstr_t, const tregex&); 35 | 36 | class Analyzer 37 | { 38 | public: 39 | 40 | void calc(); 41 | void calc(const string& label, refstr_t data, refstr_t filter, int iterations, talgo method, Algorithms& alg, int average); 42 | void calc(const string& label, refstr_t data, refstr_t filter, int iterations, tralgo method, Algorithms& alg, int average); 43 | 44 | protected: 45 | 46 | void tryAlgo(refstr_t data, refstr_t filter, int iterations, int average); 47 | void tryRegex(refstr_t data, refstr_t filter, int iterations, int average); 48 | 49 | }; 50 | 51 | }}} -------------------------------------------------------------------------------- /algo/EssAndExt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2013-2021 Denis Kuzmin github/3F 5 | * Copyright (c) regXwild contributors https://github.com/3F/regXwild 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | 26 | #pragma once 27 | 28 | #include "typedefs.h" 29 | #include "Meter.h" 30 | 31 | #include "..\regXwild\regXwildAPI.h" 32 | 33 | //#include "AlgorithmExt.h" 34 | //#include "AlgorithmEss.h" 35 | 36 | namespace net { namespace r_eg { namespace regXwild { 37 | 38 | struct IAnalysis 39 | { 40 | virtual bool search(const tstring& text, const tstring& filter) = 0; 41 | }; 42 | typedef IAnalysis* IAnalysis_; 43 | 44 | class AnalysisEss: public IAnalysis 45 | { 46 | public: 47 | 48 | bool search(const tstring& text, const tstring& filter) 49 | { 50 | return searchEss(text, filter, true); 51 | } 52 | 53 | protected: 54 | //AlgorithmEss alg; 55 | 56 | }; 57 | 58 | class AnalysisExt: public IAnalysis 59 | { 60 | public: 61 | 62 | bool search(const tstring& text, const tstring& filter) 63 | { 64 | return searchExt(text, filter, true); 65 | } 66 | 67 | protected: 68 | //AlgorithmExt alg; 69 | 70 | }; 71 | 72 | class EssAndExt 73 | { 74 | public: 75 | 76 | /** 77 | * ESS vs EXT 78 | */ 79 | void compare() 80 | { 81 | AnalysisExt algExt; 82 | AnalysisEss algEss; 83 | 84 | // 350 85 | tstring text = _T("JDK 6 for NetBeans 6.9 or newer, JDK 5 for NetBeans 6.8 or older (it must be 1.5.0 because NetBeans must be runnable on this version of JDK or newer, by using 1.5.0 you will ensure that you don't use APIs and features available only in JDK 6 or newer)/ Apache Ant 1.7.1/ Latest Mercurial release (at least 1.0.2), presupposing Python 2.5. 1 or later."); 86 | tstring filter; 87 | unsigned int iterations = 10000; 88 | 89 | /* ANY */ 90 | 91 | filter = _T("*NetBeans*6*8*(*must*newer**only*1*1*0***later**"); 92 | TRACE("[EXT::ANY] =~ " << analysis(&algExt, text, filter, iterations) << "ms\n"); 93 | TRACE("[ESS::ANY] =~ " << analysis(&algEss, text, filter, iterations) << "ms\n"); 94 | 95 | 96 | /* ANYSP */ 97 | 98 | filter = _T("*NetBeans*6*8*(>must>newer>only*1*1*0***later**"); 99 | TRACE("[EXT::ANYSP] =~ " << analysis(&algExt, text, filter, iterations) << "ms\n"); 100 | TRACE("[ESS::ANYSP] =~ " << analysis(&algEss, text, filter, iterations) << "ms\n"); 101 | 102 | /* ONE */ 103 | 104 | filter = _T("NetBeans ?.*must*be?1**because*must be*Ant?1.7*or later"); 105 | TRACE("[EXT::ONE] =~ " << analysis(&algExt, text, filter, iterations) << "ms\n"); 106 | TRACE("[ESS::ONE] =~ " << analysis(&algEss, text, filter, iterations) << "ms\n"); 107 | 108 | /* SPLIT */ 109 | 110 | filter = _T("*NetBeans*6*8*(*must*newer*notfound*API*only|**only*1*1*0***later*notfound*NetBeans*6*8*|*NetBeans*6*8*(*must*newer**only*1*1*0***later**|*NetBeans*6*8*(>must>newer>only*1*1*0***later**|NetBeans ?.*must*be?1**because*must be*Ant?1.7*or later"); 111 | TRACE("[EXT::SPLIT] =~ " << analysis(&algExt, text, filter, iterations) << "ms\n"); 112 | TRACE("[ESS::SPLIT] =~ " << analysis(&algEss, text, filter, iterations) << "ms\n"); 113 | 114 | /* BEGIN */ 115 | filter = _T("^JDK 6"); 116 | TRACE("[ESS::BEGIN] =~ " << analysis(&algEss, text, filter, iterations) << "ms\n"); 117 | 118 | /* END */ 119 | filter = _T("or later.$"); 120 | TRACE("[ESS::END] =~ " << analysis(&algEss, text, filter, iterations) << "ms\n"); 121 | 122 | /* MORE */ 123 | filter = _T("NetBeans+must be+1.5"); 124 | TRACE("[ESS::MORE] =~ " << analysis(&algEss, text, filter, iterations) << "ms\n"); 125 | 126 | /* SINGLE */ 127 | filter = _T("JDK # for NetBeans #"); 128 | TRACE("[ESS::SINGLE] =~ " << analysis(&algEss, text, filter, iterations) << "ms\n"); 129 | 130 | }; 131 | 132 | protected: 133 | 134 | clock_t analysis(IAnalysis_ alg, const tstring& text, const tstring& filter, unsigned int iterations) 135 | { 136 | Meter meter; 137 | clock_t results = 0; 138 | unsigned int max = 50; 139 | 140 | for(unsigned int total = 0; total < max; ++total){ 141 | meter.start(); 142 | for(unsigned int i = 0; i < iterations; ++i){ 143 | if(alg->search(text, filter)){ 144 | //... 145 | } 146 | } 147 | results += meter.delta(); 148 | } 149 | return results / max; 150 | } 151 | }; 152 | 153 | }}} -------------------------------------------------------------------------------- /algo/Meter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2013-2021 Denis Kuzmin github/3F 5 | * Copyright (c) regXwild contributors https://github.com/3F/regXwild 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | 26 | #pragma once 27 | 28 | #include "typedefs.h" 29 | 30 | namespace net { namespace r_eg { namespace regXwild { 31 | 32 | class Meter 33 | { 34 | public: 35 | void start() 36 | { 37 | _started = clock(); 38 | } 39 | 40 | clock_t delta() 41 | { 42 | return clock() - _started; 43 | } 44 | 45 | Meter(void): _started(0) { }; 46 | ~Meter(void) { }; 47 | 48 | private: 49 | clock_t _started; 50 | }; 51 | 52 | }}} -------------------------------------------------------------------------------- /algo/Readme.md: -------------------------------------------------------------------------------- 1 | ## ⚠ The `algo` is obsolete 2 | 3 | Please consider using the **modern optimized implementation** that has been applied in *regXwild*. 4 | 5 | [https://github.com/3F/regXwild](https://github.com/3F/regXwild) -------------------------------------------------------------------------------- /algo/Util.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2013-2021 Denis Kuzmin github/3F 5 | * Copyright (c) regXwild contributors https://github.com/3F/regXwild 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | 26 | #pragma once 27 | 28 | #include "typedefs.h" 29 | 30 | namespace net { namespace r_eg { namespace regXwild 31 | { 32 | using namespace std; 33 | using namespace net::r_eg::regXwild::rxwtypes; 34 | 35 | class Util 36 | { 37 | public: 38 | 39 | inline static tstring uppercase(tstring str) throw() 40 | { 41 | transform(str.begin(), str.end(), str.begin(), __toxupper); 42 | return str; 43 | }; 44 | 45 | inline static tstring lowercase(tstring str) throw() 46 | { 47 | transform(str.begin(), str.end(), str.begin(), __toxlower); 48 | return str; 49 | }; 50 | 51 | static tstring strReplace(const tstring& replace, const tstring& replacement, tstring str) 52 | { 53 | udiff_t pos = 0; 54 | while((pos = str.find(replace, pos)) != tstring::npos){ 55 | str.replace(pos, replace.length(), replacement); 56 | pos += replacement.length(); 57 | } 58 | return str; 59 | }; 60 | 61 | protected: 62 | Util(void){}; 63 | 64 | }; 65 | 66 | }}} -------------------------------------------------------------------------------- /algo/algo.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | Debug 7 | Win32 8 | 9 | 10 | Release 11 | Win32 12 | 13 | 14 | Debug 15 | x64 16 | 17 | 18 | Release 19 | x64 20 | 21 | 22 | 23 | {7571CD36-4A3C-446F-96B1-951261274B78} 24 | net::r_eg::regXwild.algo 25 | v$(VisualStudioVersion.Replace(".", "")) 26 | v141 27 | v142 28 | $(LatestTargetPlatformVersion) 29 | 10.0 30 | 31 | 32 | 33 | Application 34 | true 35 | 36 | 37 | Application 38 | false 39 | true 40 | 41 | 42 | Application 43 | true 44 | 45 | 46 | Application 47 | false 48 | true 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | true 70 | $(ProjectDir);$(IncludePath) 71 | 72 | 73 | true 74 | $(ProjectDir);$(IncludePath) 75 | 76 | 77 | false 78 | $(ProjectDir);$(IncludePath) 79 | 80 | 81 | false 82 | $(ProjectDir);$(IncludePath) 83 | 84 | 85 | 86 | Use 87 | Level3 88 | Disabled 89 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 90 | true 91 | 92 | 93 | Console 94 | true 95 | 96 | 97 | 98 | 99 | Use 100 | Level3 101 | Disabled 102 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 103 | true 104 | 105 | 106 | Console 107 | true 108 | 109 | 110 | 111 | 112 | Level3 113 | Use 114 | MaxSpeed 115 | true 116 | true 117 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 118 | true 119 | 120 | 121 | Console 122 | true 123 | true 124 | true 125 | 126 | 127 | 128 | 129 | Level3 130 | Use 131 | MaxSpeed 132 | true 133 | true 134 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 135 | true 136 | 137 | 138 | Console 139 | true 140 | true 141 | true 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | Create 160 | Create 161 | Create 162 | Create 163 | 164 | 165 | 166 | 167 | {74660324-42aa-41b6-9fdb-e0ed0d0144ce} 168 | 169 | 170 | 171 | 172 | 173 | -------------------------------------------------------------------------------- /algo/algo.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | Header Files 32 | 33 | 34 | Header Files 35 | 36 | 37 | Header Files 38 | 39 | 40 | Header Files 41 | 42 | 43 | 44 | 45 | Source Files 46 | 47 | 48 | Source Files 49 | 50 | 51 | Source Files 52 | 53 | 54 | Source Files 55 | 56 | 57 | -------------------------------------------------------------------------------- /algo/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2013-2021 Denis Kuzmin github/3F 5 | * Copyright (c) regXwild contributors https://github.com/3F/regXwild 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | 26 | #include "stdafx.h" 27 | 28 | #include "Algorithms.h" 29 | #include "Analyzer.h" 30 | #include "EssAndExt.h" 31 | 32 | using namespace net::r_eg::regXwild; 33 | 34 | 35 | int main() 36 | { 37 | 38 | TRACE("https://github.com/3F/regXwild \n\n"); 39 | 40 | #if _DEBUG 41 | 42 | Algorithms alg; 43 | alg.mainTest(); 44 | 45 | TRACE("\n[WARN] You need use Release-based configurations.\n\n"); 46 | 47 | #else 48 | 49 | /* 50 | 51 | Find + Find: ~58ms 52 | Iterator + Find: ~57ms 53 | Getline + Find: ~59ms 54 | Iterator + Substr: ~165ms 55 | Iterator + Iterator: ~136ms 56 | main :: based on Iterator + Find: ~53ms 57 | 58 | ----------- 59 | regexp-c++11(search): ~64063ms 60 | regexp-c++11(only as ^match$ like a '=='): ~34ms 61 | regexp-c++11(match*): ~64329ms 62 | [EXT::ANY] =~ 54ms 63 | [ESS::ANY] =~ 55ms 64 | [EXT::ANYSP] =~ 60ms 65 | [ESS::ANYSP] =~ 59ms 66 | [EXT::ONE] =~ 56ms 67 | [ESS::ONE] =~ 56ms 68 | [EXT::SPLIT] =~ 92ms 69 | [ESS::SPLIT] =~ 94ms 70 | [ESS::BEGIN] =~ 38ms 71 | [ESS::END] =~ 39ms 72 | [ESS::MORE] =~ 44ms 73 | [ESS::SINGLE] =~ 43ms 74 | 75 | */ 76 | 77 | Analyzer anl; 78 | anl.calc(); 79 | 80 | TRACE("\n------\nESS vs EXT:\n\n"); 81 | 82 | EssAndExt eve; 83 | eve.compare(); 84 | 85 | TRACE("\ndone.\n\n"); 86 | 87 | #endif 88 | 89 | system("pause"); 90 | return 0; 91 | } 92 | 93 | -------------------------------------------------------------------------------- /algo/stdafx.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2013-2021 Denis Kuzmin github/3F 5 | * Copyright (c) regXwild contributors https://github.com/3F/regXwild 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | 26 | // algo.pch will be the pre-compiled header 27 | // stdafx.obj will contain the pre-compiled type information 28 | 29 | #include "stdafx.h" -------------------------------------------------------------------------------- /algo/stdafx.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2013-2021 Denis Kuzmin github/3F 5 | * Copyright (c) regXwild contributors https://github.com/3F/regXwild 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | 26 | #pragma once 27 | 28 | #include "targetver.h" 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | -------------------------------------------------------------------------------- /algo/targetver.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2013-2021 Denis Kuzmin github/3F 5 | * Copyright (c) regXwild contributors https://github.com/3F/regXwild 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | 26 | #pragma once 27 | 28 | // Including SDKDDKVer.h defines the highest available Windows platform. 29 | 30 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 31 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 32 | 33 | #include 34 | -------------------------------------------------------------------------------- /algo/typedefs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2013-2021 Denis Kuzmin github/3F 5 | * Copyright (c) regXwild contributors https://github.com/3F/regXwild 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | 26 | #pragma once 27 | 28 | #include "stdafx.h" 29 | #include "..\regXwild\typedefs.h" 30 | 31 | namespace net { namespace r_eg { namespace regXwild 32 | { 33 | using namespace std; 34 | using namespace net::r_eg::regXwild::rxwtypes; 35 | 36 | typedef const tstring& refstr_t; 37 | 38 | typedef basic_regex tregex; 39 | 40 | #ifdef RXW_UNICODE 41 | 42 | typedef wstringstream tstringStream; 43 | #define __toxupper towupper 44 | 45 | #else 46 | 47 | typedef stringstream tstringStream; 48 | #define __toxupper toupper 49 | 50 | #endif 51 | 52 | #define TRACE(str){ cout << str; } 53 | #define DELTAINFO(str, num){ cout << str; (num < 1)? cout << "< 1" : cout << "~" << num; cout << "ms\n"; } 54 | 55 | }}} -------------------------------------------------------------------------------- /build.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | set cim=packages\vsSolutionBuildEvent\cim.cmd -vsw-priority "Microsoft.VisualStudio.Component.VC.Redist.14.Latest" 4 | set _gnt=tools/gnt 5 | 6 | set reltype=%~1 7 | if not defined reltype ( 8 | set reltype=Release 9 | ) 10 | 11 | call %_gnt% /p:wpath="%cd%" /p:ngconfig="packages.config;snet\\packages.config" /nologo /v:m /m:4 || goto err 12 | 13 | setlocal 14 | set "__InitBuild=1" & call :build Win32 Unicode 15 | endlocal 16 | 17 | call :build Win32 MultiByte 18 | call :build x64 Unicode 19 | 20 | setlocal 21 | set "__FinalBuild=1" & call :build x64 MultiByte 22 | endlocal 23 | 24 | 25 | goto exit 26 | 27 | 28 | :build 29 | setlocal 30 | set "platform=%~1" & set "CharacterSet=%~2" 31 | call %cim% "regXwild.sln" /v:m /m:4 /p:Configuration="%reltype%" /p:Platform=%platform% || goto err 32 | endlocal 33 | exit /B 0 34 | 35 | :err 36 | 37 | echo. Build failed. 1>&2 38 | exit /B 1 39 | 40 | :exit 41 | exit /B 0 -------------------------------------------------------------------------------- /changelog.txt: -------------------------------------------------------------------------------- 1 | - - - - - - - - - - - - - - - - - - - - - 2 | regXwild - https://github.com/3F/regXwild 3 | - - - - - - - - - - - - - - - - - - - - - 4 | 5 | [v1.4] 2021.03.07 6 | 7 | * NEW: Modern `match()` method for ESS implementation with bitwise options: 8 | ``` 9 | bool match(const tstring& input, const tstring& pattern, const EngineOptions& options, MatchResult* result); 10 | ``` 11 | Searches an input string for a substring that matches a pattern. 12 | Use F_ICASE = 0x001 to ignore case sensitivity when matching. 13 | 14 | * NEW: Implemented `>c` metasymbol. 15 | Modern `>` as [^c]*str | [^c]*$ 16 | 17 | This is default behavior using match(). 18 | To activate legacy `>` as [^/]*str | [^/]*$ use F_LEGACY_ANYSP = 0x080 19 | 20 | * NEW: Implemented F_MATCH_RESULT = 0x002 flag to collect additional data for the MatchResult. 21 | ``` 22 | EssRxW::MatchResult m; 23 | rxw.match 24 | ( 25 | _T("number = '8888'; //TODO: up"), 26 | _T("'+'"), 27 | EssRxW::EngineOptions::F_MATCH_RESULT, 28 | &m 29 | ); 30 | //m.start = 9 31 | //m.end = 15 32 | ``` 33 | 34 | * NEW: Added `replace()` method for ESS implementation. 35 | ``` 36 | bool replace(tstring& input, const tstring& pattern, const tstring& replacement, const EngineOptions& options); 37 | ``` 38 | In a specified input, replaces first substring that match a specified pattern with a specified replacement string. 39 | 40 | * NEW: Implemented optional offset for `match()` and `replace()` methods. ESS impl. 41 | ``` 42 | bool replace(tstring& input, const tstring& pattern, const tstring& replacement, udiff_t offset, const EngineOptions& options) 43 | bool match(const tstring& input, const tstring& pattern, udiff_t offset, const EngineOptions& options, MatchResult* result) 44 | ``` 45 | udiff_t offset - The starting position to start matching. 46 | 47 | * NEW: Implemented F_MATCH_ALL = 0x004. Do not finish on first match in replace() method. 48 | 49 | * NEW: New C-export functions in common.h PE/Invoke or other outside environments. 50 | ``` 51 | bool replace(TCHAR* input, const TCHAR* pattern, const TCHAR* replacement, flagcfg_t options); 52 | bool replaceOfs(TCHAR* input, const TCHAR* pattern, const TCHAR* replacement, udiff_t offset, flagcfg_t options); 53 | bool match(const TCHAR* input, const TCHAR* pattern, flagcfg_t options, EssRxW::MatchResult* result); 54 | bool matchOfs(const TCHAR* input, const TCHAR* pattern, udiff_t offset, flagcfg_t options, EssRxW::MatchResult* result); 55 | bool replaceTo(const TCHAR* input, const TCHAR* pattern, const TCHAR* replacement, TCHAR* to, udiff_t offset, flagcfg_t options); 56 | ``` 57 | 58 | * FIXED: Fixed SINGLE ms for +++ and `system+` or like. 59 | 60 | * FIXED: Fixed END ms `$` and BEGIN ms `^` when using other available ms. 61 | 62 | * FIXED: Fixed ##?? ++?? for " = 12" -> "= 123". 63 | 64 | * FIXED: Fixed an early return when matching. 65 | 66 | * FIXED: Fixed Compiler Error such C2758 etc for C99/MSVC10 compilers (VS2010). 67 | 68 | * FIXED: Fixed NuGet package use for native C/C++ projects. 69 | 70 | * CHANGED: Implemented MS combinations for END $ such as *$, ??$, +$. 71 | 72 | * CHANGED: Implemented MS combinations for BEGIN ^ such as ^+, ^#, ^?. 73 | 74 | * CHANGED: Added aliases EssRxW/ExtRxW/RxW to the main algorithms. 75 | 76 | * CHANGED: Added RXW_UNICODE for user targets when CharacterSet is Unicode. 77 | 78 | * CHANGED: `AlgorithmEss::search()` was marked as obsolete and can be removed in future major versions. 79 | 80 | * CHANGED: regXwildAPI.h was marked as obsolete. Please use regXwild.common.h or regXwild.h. 81 | 82 | * CHANGED: Most our types are spaced now as regXwild::rxwtypes. 83 | 84 | * NOTE: You can find various flexible use for .NET in our new dotnet-test project through Conari engine: 85 | https://github.com/3F/Conari 86 | https://github.com/3F/regXwild 87 | 88 | 89 | [v1.3] 2020.08.10 90 | 91 | * NEW: Quantifiers are now standardized as follows: 92 | https://github.com/3F/regXwild#-quantifiers 93 | 94 | regex | regXwild | n 95 | ----------------|------------|--------- 96 | .\* | \* | 0+ 97 | .+ | + | 1+ 98 | .? | ? | 0; 1 99 | .{1} | # | 1 100 | .{2} | ## | 2 101 | .{2, } | ++ | 2+ 102 | .{0, 2} | ?? | 0 - 2 103 | .{2, 4} | ++?? | 2 - 4 104 | (?:.{2}\|.{4}) | ##?? | 2; 4 105 | .{3, 4} | +++? | 3 - 4 106 | (?:.{1}\|.{3}) | #?? | 1; 3 107 | 108 | * NEW: Second-order Quantifiers. Added support for `++` 109 | regex equivalent `.{n, }` 110 | 111 | * NEW: Quantifiers. Implemented `++??` support for ranges. Part of PR #7. 112 | ``` 113 | {n, m} where n > 0 and m > n 114 | 115 | n == + 116 | m == ? 117 | ``` 118 | * `++??` (2 - 4) 119 | * `+???` (1 - 4) 120 | * `+++?` (3 - 4) 121 | * `+?` (1 - 2) 122 | 123 | etc. See unit-tests. 124 | 125 | * NEW: Quantifiers. Implemented `##??` support for ranges. Part of PR #7. 126 | ``` 127 | {n, m} where n > 0 and m > n 128 | 129 | n == # 130 | m == ? 131 | ``` 132 | * `##??` (2 | 4) 133 | * `#???` (1 | 4) 134 | * `###?` (3 | 4) 135 | * `#?` (1 | 2) 136 | 137 | etc. See unit-tests. 138 | 139 | * FIXED: Fixed rewind in MS-split `|` like for '##'|'####' 140 | 141 | * FIXED: Fixed errors in second order quantifiers: `?? == .{0, 2}` and `## == .{2}` 142 | For example: 143 | * False positive matching `[1####_of` for `TV_[11_of_24]` 144 | * Crashed `number = '????';` for `number = '123';` 145 | * and related. 146 | 147 | * CHANGED: API versionString() marked as obsolete due to RXWVersion. 148 | 149 | 150 | [v1.2] 2020.02.10 151 | 152 | * NEW: MultiByte support. 153 | Now you can use modules with MultiByte characters. 154 | 155 | For C++ projects it will be automatically selected 156 | according to the actual project configuration. 157 | 158 | For .NET, you need to override related `CharacterSet` property. 159 | 160 | * NEW: .NET Core based projects support through Conari and related: 161 | Including .NET Standard targeting; 162 | 163 | Just install our modern NuGet packages; 164 | https://www.nuget.org/packages/regXwild 165 | 166 | * CHANGED: Modules with MultiByte characters for .NET projects by default. 167 | You can replace this by the changing $(CharacterSet) msbuild property: 168 | ``` 169 | Unicode 170 | ``` 171 | 172 | * CHANGED: Added the following tools to packages for related build processes. 173 | 174 | * tools\gnt.bat - https://github.com/3F/GetNuTool 175 | * tools\hMSBuild.bat - https://github.com/3F/hMSBuild 176 | 177 | * CHANGED: `algo` and `snet` testers can be found inside packages 178 | for each $(Platform)-$(CharacterSet) 179 | 180 | * CHANGED: Conari will no longer be distributed together with regXwild. 181 | https://github.com/3F/Conari 182 | 183 | Please consider to use it separately. Conari nuget packages: 184 | https://www.nuget.org/packages/Conari/ 185 | 186 | (recommended due to caching of 0x29 opcodes and other related optimization) 187 | 188 | * NOTE: Offcial releases can be also found through GitHub Releases: 189 | https://github.com/3F/regXwild/releases 190 | 191 | 192 | [v1.1] 193 | 194 | CHANGED: Updated API: 195 | +REGXWILD_API bool searchEssC(const TCHAR* data, const TCHAR* filter, bool ignoreCase); 196 | +REGXWILD_API bool searchExtC(const TCHAR* data, const TCHAR* filter, bool ignoreCase); 197 | 198 | FIXED: Headers for C linkage and removed REGXWILD_EXPORTS from conf. 199 | NEW: Added Conari engine for work in .NET 200 | https://github.com/3F/Conari 201 | Use our NuGet package for Native C/C++ & .NET projects. 202 | 203 | [v1.0] 204 | 205 | * First public release. 206 | regXwild - Fast and powerful wildcards ! in addition to slow regex engine and more... 207 | The initial non-public versions from 2013-2014 you can find in sandbox. -------------------------------------------------------------------------------- /common.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Unicode 5 | $(DefineConstants);RXW_UNICODE 6 | 7 | $(Platform) 8 | Win32 9 | 10 | bin\raw\$(Configuration)\$(PlatformArch)\$(CharacterSet)\ 11 | ..\bin\obj\$(MSBuildProjectName)\$(Configuration)\$(PlatformArch)\$(CharacterSet)\ 12 | 13 | ..\$(OutRawDir)\ 14 | $([MSBuild]::Escape($([System.IO.Path]::GetFullPath(`$([System.IO.Path]::Combine(`$(SolutionDir)`, `$(OutRawDir)`))`)))) 15 | 16 | 17 | 18 | RXW_UNICODE;%(PreprocessorDefinitions) 19 | 20 | 21 | 22 | 23 | 4480;4482;%(DisableSpecificWarnings) 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /dotnetTest/ConariMatchTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using dotnetTest._svc; 3 | using net.r_eg.Conari; 4 | using net.r_eg.Conari.Types; 5 | using Xunit; 6 | using static dotnetTest._svc.TestHelper; 7 | 8 | namespace dotnetTest 9 | { 10 | public class ConariMatchTest 11 | { 12 | [Fact] 13 | public void matchTest1() 14 | { 15 | using var c = ConariX.Make(new(Library), out dynamic l); 16 | using var u = new NativeStruct(); 17 | 18 | Assert.True(l.match("system", "syStem", EngineOptions.F_ICASE | EngineOptions.F_MATCH_RESULT, u)); 19 | Assert.Equal(n(0), u.Data.start); 20 | Assert.Equal(n(6), u.Data.end); 21 | 22 | Assert.False(l.match("system", "1", EngineOptions.F_NONE, u)); 23 | Assert.Equal(MatchResult.npos, u.read().Data.start); 24 | 25 | Assert.True(l.matchOfs("number_str = '+12'", "str", n(5), EngineOptions.F_NONE, u)); 26 | Assert.Equal(MatchResult.npos, u.read().Data.start); 27 | 28 | Assert.True(l.matchOfs("number_str = '+12'", "str", n(5), EngineOptions.F_MATCH_RESULT, u)); 29 | u.read(); 30 | Assert.Equal(n(7), u.Data.start); 31 | Assert.Equal(n(10), u.Data.end); 32 | 33 | Assert.False(l.matchOfs("number_str = '+12'", "str", n(8), EngineOptions.F_NONE, u)); 34 | Assert.Equal(MatchResult.npos, u.read().Data.start); 35 | } 36 | 37 | [Fact] 38 | public void searchTest1() 39 | { 40 | using var c = ConariX.Make(new(Library), out dynamic l); 41 | Assert.False(l.searchEssC("system", "syStem", false)); 42 | Assert.True(l.searchEssC("system", "syStem", true)); 43 | 44 | Assert.True(l.searchEssC("number = '12'", "'+'", false)); 45 | 46 | Assert.False(l.searchEssC("123", "4", true)); 47 | Assert.True(l.searchEssC("123", "2", true)); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /dotnetTest/ConariReplaceTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using dotnetTest._svc; 3 | using net.r_eg.Conari; 4 | using net.r_eg.Conari.Types; 5 | using Xunit; 6 | using static dotnetTest._svc.TestHelper; 7 | 8 | namespace dotnetTest 9 | { 10 | public class ConariReplaceTest 11 | { 12 | [Fact] 13 | public void replaceTest1() 14 | { 15 | using var c = ConariX.Make(new(Library), out dynamic l); 16 | using var data = new NativeString("numberStr = '+12'"); 17 | 18 | bool res = l.replace(data, "str*'+'", " = '008888';", EngineOptions.F_NONE); 19 | Assert.False(res); 20 | Assert.True("numberStr = '+12'" == data); 21 | 22 | res = l.replace(data, "str*'+'", " = '008888';", EngineOptions.F_ICASE); 23 | Assert.True(res); 24 | Assert.True("number = '008888';" == data); 25 | } 26 | 27 | [Fact] 28 | public void replaceTest2() 29 | { 30 | using var c = ConariX.Make(new(Library), out dynamic l); 31 | 32 | Assert.False(l.replace(IntPtr.Zero, "str*'+'", " = '008888';")); 33 | 34 | using var data = new NativeString("number_str = '+12'"); 35 | Assert.False(l.replaceOfs(data, "_str*'+'", " = '';", n(7))); 36 | Assert.True(l.replaceOfs(data, "_str*'+'", " = '';", n(6))); 37 | Assert.True("number = '';" == data); 38 | } 39 | 40 | [Fact] 41 | public void replaceToTest1() 42 | { 43 | using var c = ConariX.Make(new(Library), out dynamic l); 44 | 45 | using(var to = new NativeString()) 46 | { 47 | bool res = l.replaceTo("numberStr = '+12'", "str*'+'", " = '008888';", to, n(0), EngineOptions.F_ICASE); 48 | Assert.True(res); 49 | Assert.True("number = '008888';" == to); 50 | } 51 | 52 | using(var to = new NativeString()) 53 | { 54 | bool res = l.replaceTo("numberStr = '+12'", "str*'+'", " = '008888';", to, n(0), EngineOptions.F_NONE); 55 | Assert.False(res); 56 | } 57 | } 58 | 59 | [Fact] 60 | public void replaceToTest2() 61 | { 62 | using var c = ConariX.Make(new(Library), out dynamic l); 63 | 64 | Assert.False(l.replaceTo(IntPtr.Zero, "'+'", "''", IntPtr.Zero)); 65 | 66 | using var data = new NativeString("number_str = '+12'"); 67 | Assert.True(l.replaceTo(data, "_str*'+'", " = '';", IntPtr.Zero, n(0))); 68 | Assert.True("number_str = '+12'" == data); 69 | 70 | Assert.False(l.replaceTo(data, "_str*'+'", " = '';", IntPtr.Zero, n(7), EngineOptions.F_ICASE)); 71 | Assert.True("number_str = '+12'" == data); 72 | 73 | using var to = new NativeString(); 74 | Assert.True(l.replaceTo(data, "_str*'+'", " = '';", to, n(6), EngineOptions.F_ICASE)); 75 | Assert.True("number_str = '+12'" == data); 76 | Assert.True("number = '';" == to); 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /dotnetTest/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "dotnetTest": { 4 | "commandName": "Project", 5 | "nativeDebugging": true 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /dotnetTest/_svc/EngineOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace dotnetTest._svc 4 | { 5 | [Flags] 6 | internal enum EngineOptions: uint 7 | { 8 | F_NONE = 0, 9 | 10 | /// 11 | /// Ignore case sensitivity when matching. 12 | /// 13 | F_ICASE = 0x001, 14 | 15 | /// 16 | /// Collect additional data for the MatchResult. 17 | /// 18 | F_MATCH_RESULT = 0x002, 19 | 20 | /// 21 | /// Do not finish on first match. 22 | /// 23 | F_MATCH_ALL = 0x004, 24 | 25 | #if _RXW_FEATURE_MATCH_MAP 26 | /// 27 | /// Collect the positions of all occurrences 28 | /// between each presented metasymbol. 29 | /// 30 | F_MATCH_MAP = 0x008, 31 | #endif 32 | 33 | /// 34 | /// Use MS_ANYSP as [^/]* (legacy). 35 | /// Otherwise as [^c]* where `c` is a symbol from the next presented symbol after MS_ANYSP. 36 | /// 37 | F_LEGACY_ANYSP = 0x080, 38 | } 39 | } -------------------------------------------------------------------------------- /dotnetTest/_svc/InitTests.cs: -------------------------------------------------------------------------------- 1 | using net.r_eg.Conari.Types; 2 | using Xunit.Abstractions; 3 | using Xunit.Sdk; 4 | 5 | [assembly: Xunit.TestFramework 6 | ( 7 | nameof(dotnetTest) + "." + nameof(dotnetTest._svc) + "." + nameof(dotnetTest._svc.InitTests), 8 | nameof(dotnetTest) 9 | )] 10 | 11 | namespace dotnetTest._svc 12 | { 13 | public class InitTests: XunitTestFramework 14 | { 15 | public InitTests(IMessageSink messageSink) 16 | : base(messageSink) 17 | { 18 | #if RXW_UNICODE 19 | TCharPtr.Unicode = true; 20 | #else 21 | TCharPtr.Unicode = false; 22 | #endif 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /dotnetTest/_svc/MatchResult.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace dotnetTest._svc 4 | { 5 | [StructLayout(LayoutKind.Sequential)] 6 | internal struct MatchResult 7 | { 8 | public static readonly nuint npos = nuint.MaxValue; 9 | 10 | /// 11 | /// Position of the first occurrence or MatchResult::npos. 12 | /// It also will be MatchResult::npos if not EngineOptions::F_MATCH_RESULT. 13 | /// 14 | public nuint start; 15 | 16 | /// 17 | /// Position of the last occurrence. 18 | /// Valid only if `MatchResult::start` != MatchResult::npos. 19 | /// 20 | public nuint end; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /dotnetTest/_svc/TestHelper.cs: -------------------------------------------------------------------------------- 1 | namespace dotnetTest._svc 2 | { 3 | internal static class TestHelper 4 | { 5 | public static string Library => @"..\regXwild.dll"; 6 | 7 | internal static nuint n(nuint v) => v; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /dotnetTest/dotnetTest.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | net5.0 7 | false 8 | x64;x86 9 | Debug;Release;PublicRelease 10 | 1701;1702;CS1591;IDE1006 11 | $(OutDir)\$(MSBuildProjectName)\ 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | all 20 | runtime; build; native; contentfiles; analyzers; buildtransitive 21 | 22 | 23 | all 24 | runtime; build; native; contentfiles; analyzers; buildtransitive 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /regXwild.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29709.97 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "regXwild", "regXwild\regXwild.vcxproj", "{74660324-42AA-41B6-9FDB-E0ED0D0144CE}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "regXwildTest", "regXwildTest\regXwildTest.vcxproj", "{B43C60C4-7B0D-466B-BE85-11298000062A}" 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "algo", "algo\algo.vcxproj", "{7571CD36-4A3C-446F-96B1-951261274B78}" 11 | EndProject 12 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "root", "root", "{571DA510-79F7-48C0-9024-9632E16353DF}" 13 | ProjectSection(SolutionItems) = preProject 14 | .gitignore = .gitignore 15 | .version = .version 16 | build.bat = build.bat 17 | changelog.txt = changelog.txt 18 | gnt.core = gnt.core 19 | LICENSE = LICENSE 20 | packages.config = packages.config 21 | Readme.md = Readme.md 22 | tools\regXwild.dotnet.targets = tools\regXwild.dotnet.targets 23 | tools\regXwild.native.targets = tools\regXwild.native.targets 24 | tools\regXwild.nuspec = tools\regXwild.nuspec 25 | EndProjectSection 26 | EndProject 27 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{9390762C-88DF-4FF5-BD50-CCF3694BDFD9}" 28 | ProjectSection(SolutionItems) = preProject 29 | tools\gnt.bat = tools\gnt.bat 30 | tools\msbuild.bat = tools\msbuild.bat 31 | EndProjectSection 32 | EndProject 33 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "snet", "snet\snet.csproj", "{12B25935-229F-4128-B66B-7561A77ABC54}" 34 | EndProject 35 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnetTest", "dotnetTest\dotnetTest.csproj", "{0BAB6AFC-5D51-4645-BF8E-61F1C296B6FE}" 36 | EndProject 37 | Global 38 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 39 | Debug|Win32 = Debug|Win32 40 | Debug|x64 = Debug|x64 41 | PublicRelease|Win32 = PublicRelease|Win32 42 | PublicRelease|x64 = PublicRelease|x64 43 | Release|Win32 = Release|Win32 44 | Release|x64 = Release|x64 45 | EndGlobalSection 46 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 47 | {74660324-42AA-41B6-9FDB-E0ED0D0144CE}.Debug|Win32.ActiveCfg = Debug|Win32 48 | {74660324-42AA-41B6-9FDB-E0ED0D0144CE}.Debug|Win32.Build.0 = Debug|Win32 49 | {74660324-42AA-41B6-9FDB-E0ED0D0144CE}.Debug|x64.ActiveCfg = Debug|x64 50 | {74660324-42AA-41B6-9FDB-E0ED0D0144CE}.Debug|x64.Build.0 = Debug|x64 51 | {74660324-42AA-41B6-9FDB-E0ED0D0144CE}.PublicRelease|Win32.ActiveCfg = Release|Win32 52 | {74660324-42AA-41B6-9FDB-E0ED0D0144CE}.PublicRelease|Win32.Build.0 = Release|Win32 53 | {74660324-42AA-41B6-9FDB-E0ED0D0144CE}.PublicRelease|x64.ActiveCfg = Release|x64 54 | {74660324-42AA-41B6-9FDB-E0ED0D0144CE}.PublicRelease|x64.Build.0 = Release|x64 55 | {74660324-42AA-41B6-9FDB-E0ED0D0144CE}.Release|Win32.ActiveCfg = Release|Win32 56 | {74660324-42AA-41B6-9FDB-E0ED0D0144CE}.Release|Win32.Build.0 = Release|Win32 57 | {74660324-42AA-41B6-9FDB-E0ED0D0144CE}.Release|x64.ActiveCfg = Release|x64 58 | {74660324-42AA-41B6-9FDB-E0ED0D0144CE}.Release|x64.Build.0 = Release|x64 59 | {B43C60C4-7B0D-466B-BE85-11298000062A}.Debug|Win32.ActiveCfg = Debug|Win32 60 | {B43C60C4-7B0D-466B-BE85-11298000062A}.Debug|Win32.Build.0 = Debug|Win32 61 | {B43C60C4-7B0D-466B-BE85-11298000062A}.Debug|x64.ActiveCfg = Debug|x64 62 | {B43C60C4-7B0D-466B-BE85-11298000062A}.Debug|x64.Build.0 = Debug|x64 63 | {B43C60C4-7B0D-466B-BE85-11298000062A}.PublicRelease|Win32.ActiveCfg = Release|Win32 64 | {B43C60C4-7B0D-466B-BE85-11298000062A}.PublicRelease|Win32.Build.0 = Release|Win32 65 | {B43C60C4-7B0D-466B-BE85-11298000062A}.PublicRelease|x64.ActiveCfg = Release|x64 66 | {B43C60C4-7B0D-466B-BE85-11298000062A}.PublicRelease|x64.Build.0 = Release|x64 67 | {B43C60C4-7B0D-466B-BE85-11298000062A}.Release|Win32.ActiveCfg = Release|Win32 68 | {B43C60C4-7B0D-466B-BE85-11298000062A}.Release|Win32.Build.0 = Release|Win32 69 | {B43C60C4-7B0D-466B-BE85-11298000062A}.Release|x64.ActiveCfg = Release|x64 70 | {B43C60C4-7B0D-466B-BE85-11298000062A}.Release|x64.Build.0 = Release|x64 71 | {7571CD36-4A3C-446F-96B1-951261274B78}.Debug|Win32.ActiveCfg = Debug|Win32 72 | {7571CD36-4A3C-446F-96B1-951261274B78}.Debug|Win32.Build.0 = Debug|Win32 73 | {7571CD36-4A3C-446F-96B1-951261274B78}.Debug|x64.ActiveCfg = Debug|x64 74 | {7571CD36-4A3C-446F-96B1-951261274B78}.Debug|x64.Build.0 = Debug|x64 75 | {7571CD36-4A3C-446F-96B1-951261274B78}.PublicRelease|Win32.ActiveCfg = Release|Win32 76 | {7571CD36-4A3C-446F-96B1-951261274B78}.PublicRelease|Win32.Build.0 = Release|Win32 77 | {7571CD36-4A3C-446F-96B1-951261274B78}.PublicRelease|x64.ActiveCfg = Release|x64 78 | {7571CD36-4A3C-446F-96B1-951261274B78}.PublicRelease|x64.Build.0 = Release|x64 79 | {7571CD36-4A3C-446F-96B1-951261274B78}.Release|Win32.ActiveCfg = Release|Win32 80 | {7571CD36-4A3C-446F-96B1-951261274B78}.Release|Win32.Build.0 = Release|Win32 81 | {7571CD36-4A3C-446F-96B1-951261274B78}.Release|x64.ActiveCfg = Release|x64 82 | {7571CD36-4A3C-446F-96B1-951261274B78}.Release|x64.Build.0 = Release|x64 83 | {12B25935-229F-4128-B66B-7561A77ABC54}.Debug|Win32.ActiveCfg = Debug|x86 84 | {12B25935-229F-4128-B66B-7561A77ABC54}.Debug|Win32.Build.0 = Debug|x86 85 | {12B25935-229F-4128-B66B-7561A77ABC54}.Debug|x64.ActiveCfg = Debug|x64 86 | {12B25935-229F-4128-B66B-7561A77ABC54}.Debug|x64.Build.0 = Debug|x64 87 | {12B25935-229F-4128-B66B-7561A77ABC54}.PublicRelease|Win32.ActiveCfg = Release|x86 88 | {12B25935-229F-4128-B66B-7561A77ABC54}.PublicRelease|Win32.Build.0 = Release|x86 89 | {12B25935-229F-4128-B66B-7561A77ABC54}.PublicRelease|x64.ActiveCfg = Release|x64 90 | {12B25935-229F-4128-B66B-7561A77ABC54}.PublicRelease|x64.Build.0 = Release|x64 91 | {12B25935-229F-4128-B66B-7561A77ABC54}.Release|Win32.ActiveCfg = Release|x86 92 | {12B25935-229F-4128-B66B-7561A77ABC54}.Release|Win32.Build.0 = Release|x86 93 | {12B25935-229F-4128-B66B-7561A77ABC54}.Release|x64.ActiveCfg = Release|x64 94 | {12B25935-229F-4128-B66B-7561A77ABC54}.Release|x64.Build.0 = Release|x64 95 | {0BAB6AFC-5D51-4645-BF8E-61F1C296B6FE}.Debug|Win32.ActiveCfg = Debug|x86 96 | {0BAB6AFC-5D51-4645-BF8E-61F1C296B6FE}.Debug|Win32.Build.0 = Debug|x86 97 | {0BAB6AFC-5D51-4645-BF8E-61F1C296B6FE}.Debug|x64.ActiveCfg = Debug|x64 98 | {0BAB6AFC-5D51-4645-BF8E-61F1C296B6FE}.Debug|x64.Build.0 = Debug|x64 99 | {0BAB6AFC-5D51-4645-BF8E-61F1C296B6FE}.PublicRelease|Win32.ActiveCfg = Release|x86 100 | {0BAB6AFC-5D51-4645-BF8E-61F1C296B6FE}.PublicRelease|Win32.Build.0 = Release|x86 101 | {0BAB6AFC-5D51-4645-BF8E-61F1C296B6FE}.PublicRelease|x64.ActiveCfg = Release|x64 102 | {0BAB6AFC-5D51-4645-BF8E-61F1C296B6FE}.PublicRelease|x64.Build.0 = Release|x64 103 | {0BAB6AFC-5D51-4645-BF8E-61F1C296B6FE}.Release|Win32.ActiveCfg = Release|x86 104 | {0BAB6AFC-5D51-4645-BF8E-61F1C296B6FE}.Release|Win32.Build.0 = Release|x86 105 | {0BAB6AFC-5D51-4645-BF8E-61F1C296B6FE}.Release|x64.ActiveCfg = Release|x64 106 | {0BAB6AFC-5D51-4645-BF8E-61F1C296B6FE}.Release|x64.Build.0 = Release|x64 107 | EndGlobalSection 108 | GlobalSection(SolutionProperties) = preSolution 109 | HideSolutionNode = FALSE 110 | EndGlobalSection 111 | GlobalSection(ExtensibilityGlobals) = postSolution 112 | SolutionGuid = {CB983F64-D9EE-4ADF-AD69-1D78A6CE1976} 113 | EndGlobalSection 114 | EndGlobal 115 | -------------------------------------------------------------------------------- /regXwild/RXWVersion.h: -------------------------------------------------------------------------------- 1 | // This code was generated by a vsSolutionBuildEvent. 2 | // Changes to this file may cause incorrect behavior and will be lost if the code is regenerated. 3 | 4 | #pragma once 5 | #ifndef _RXW_VERSION_ 6 | #define _RXW_VERSION_ 7 | 8 | #include "stdafx.h" 9 | #include "typedefs.h" 10 | 11 | namespace net { namespace r_eg { namespace regXwild 12 | { 13 | struct RXWVersion 14 | { 15 | struct TNum 16 | { 17 | const int major; 18 | const int minor; 19 | const int patch; 20 | const int build; 21 | 22 | TNum() : major(1), minor(4), patch(0), build(0) { } 23 | 24 | } number; 25 | 26 | const rxwtypes::TCHAR* bSha1; 27 | const rxwtypes::TCHAR* config; 28 | const rxwtypes::TCHAR* product; 29 | 30 | RXWVersion() : bSha1(_T("")), config(_T("")), product(_T("1.4.0")) { } 31 | }; 32 | }}} 33 | 34 | #endif // _RXW_VERSION_ 35 | -------------------------------------------------------------------------------- /regXwild/conf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2013-2021 Denis Kuzmin github/3F 5 | * Copyright (c) regXwild contributors https://github.com/3F/regXwild 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | 26 | #pragma once 27 | #ifndef _RXW_CONF_ 28 | #define _RXW_CONF_ 29 | 30 | #include "stdafx.h" 31 | 32 | // C linkage for comfortable work via Conari etc. 33 | // https://github.com/3F/Conari/issues/3 34 | #define TLINKAGE extern "C" 35 | 36 | #define _CPP11_OR_ABOVE (__cplusplus >= 201103L || _MSVC_LANG >= 201103L) 37 | #define RXW_CPP11_ENUM_CLASS _CPP11_OR_ABOVE 38 | 39 | #if RXW_CPP11_ENUM_CLASS 40 | #define RXW_ENUM_CLASS enum class 41 | #else 42 | #define RXW_ENUM_CLASS enum 43 | #endif 44 | 45 | #define _RXW_FEATURE_MATCH_RESULT 1 46 | #define _RXW_FEATURE_MATCH_MAP 0 47 | 48 | #include "declspec.h" 49 | 50 | #endif // _RXW_CONF_ -------------------------------------------------------------------------------- /regXwild/core/ESS/AlgorithmEss.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2013-2021 Denis Kuzmin github/3F 5 | * Copyright (c) regXwild contributors https://github.com/3F/regXwild 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | 26 | #pragma once 27 | 28 | #include "stdafx.h" 29 | #include "conf.h" 30 | #include "typedefs.h" 31 | #include "def.h" 32 | #include "EngineOptions.h" 33 | #include "MatchResult.h" 34 | #include "LoopAct.h" 35 | 36 | namespace net { namespace r_eg { namespace regXwild { namespace core { namespace ESS 37 | { 38 | using namespace net::r_eg::regXwild::rxwtypes; 39 | 40 | class AlgorithmEss 41 | { 42 | public: 43 | 44 | /// 45 | /// In a specified input, replaces first substring that match a specified pattern with a specified replacement string. 46 | /// 47 | /// The input string that will be modified if matched. 48 | /// Compatible pattern to match. 49 | /// The replacement string. 50 | /// A bitwise combination of the enumeration values that provide options for matching or modifications. 51 | /// True if the match was successful. 52 | REGXWILD_API bool replace(tstring& input, const tstring& pattern, const tstring& replacement, const EngineOptions& options = EngineOptions::F_NONE); 53 | 54 | /// 55 | /// In a specified input, replaces first substring that match a specified pattern with a specified replacement string. 56 | /// 57 | /// The input string that will be modified if matched. 58 | /// Compatible pattern to match. 59 | /// The replacement string. 60 | /// The starting position to start matching. 61 | /// A bitwise combination of the enumeration values that provide options for matching or modifications. 62 | /// True if the match was successful. 63 | REGXWILD_API bool replace(tstring& input, const tstring& pattern, const tstring& replacement, udiff_t offset, const EngineOptions& options = EngineOptions::F_NONE); 64 | 65 | /// 66 | /// [Obsolete] This method is obsolete and can be removed in future major versions. Please use `match()`. 67 | /// Basic search for occurrence using filter. 68 | /// 69 | /// True if found. 70 | REGXWILD_API bool search(const tstring& text, const tstring& filter, bool ignoreCase = true); 71 | 72 | /// 73 | /// Searches an input string for a substring that matches a pattern. 74 | /// 75 | /// The string to search for a match. 76 | /// Compatible pattern to match. 77 | /// A bitwise combination of the enumeration values that provide options for matching. 78 | /// Information about the match. 79 | /// True if the match was successful. 80 | REGXWILD_API bool match(const tstring& input, const tstring& pattern, const EngineOptions& options = EngineOptions::F_NONE, MatchResult* result = nullptr); 81 | 82 | /// 83 | /// Searches an input string for a substring that matches a pattern. 84 | /// 85 | /// The string to search for a match. 86 | /// Compatible pattern to match. 87 | /// The starting position to start matching. 88 | /// A bitwise combination of the enumeration values that provide options for matching. 89 | /// Information about the match. 90 | /// True if the match was successful. 91 | REGXWILD_API bool match(const tstring& input, const tstring& pattern, udiff_t offset, const EngineOptions& options = EngineOptions::F_NONE, MatchResult* result = nullptr); 92 | 93 | #if _CPP11_OR_ABOVE 94 | using EngineOptions = core::ESS::EngineOptions; 95 | using MatchResult = core::ESS::MatchResult; 96 | #else 97 | typedef core::ESS::EngineOptions EngineOptions; 98 | typedef core::ESS::MatchResult MatchResult; 99 | #endif 100 | 101 | protected: 102 | 103 | /** 104 | * (legacy) symbol for special case 105 | * regex equivalent is [^/]*str|[^/]*$ (EXT version: [^/\\]+) 106 | */ 107 | const static TCHAR ANYSP_CMP_DEFAULT = _T('/'); 108 | 109 | struct Mask 110 | { 111 | def::MetaOp curr; 112 | def::MetaOp prev; 113 | #pragma warning(push) 114 | #pragma warning(disable: 26812) // enum^ 115 | Mask() 116 | : curr(def::MetaOp::BOL), prev(def::MetaOp::BOL) 117 | { 118 | 119 | } 120 | #pragma warning(pop) 121 | }; 122 | 123 | struct ItStr 124 | { 125 | tstring::const_iterator begin; 126 | tstring::const_iterator c; 127 | tstring::const_iterator end; 128 | 129 | void reset() { c = begin; } 130 | 131 | ItStr(const tstring& str) 132 | : begin(str.cbegin()), end(str.cend()) 133 | { 134 | reset(); 135 | } 136 | }; 137 | 138 | struct Item 139 | { 140 | tstring curr; 141 | udiff_t pos; 142 | udiff_t left; 143 | udiff_t delta; 144 | Mask mask; 145 | unsigned short int overlay; 146 | 147 | unsigned short int mixpos; // ++?? 148 | def::MetaOp mixms; 149 | 150 | tstring prev; 151 | def::MetaOp bems; 152 | 153 | #if _RXW_FEATURE_MATCH_RESULT 154 | bool shiftms; 155 | #endif 156 | TCHAR anysp; 157 | MatchResult* mres; 158 | const EngineOptions* flags; 159 | 160 | ItStr it; 161 | const tstring& input; 162 | 163 | #pragma warning(push) 164 | #pragma warning(disable: 26495) 165 | //NOTE: C26495; valid for `mixms` (the first use is possible only after `mixpos` that will init `mixms`) 166 | // `curr`, `prev` 167 | Item(const tstring& input) 168 | : input(input), pos(0), left(0), delta(0), overlay(0), mixpos(0), 169 | anysp(NULL), bems(def::NONE), it(input) 170 | #if _RXW_FEATURE_MATCH_RESULT 171 | , shiftms(false) 172 | #endif 173 | { 174 | 175 | } 176 | #pragma warning(pop) 177 | 178 | }; 179 | 180 | struct FWord 181 | { 182 | udiff_t found; 183 | udiff_t left; 184 | udiff_t roff; 185 | 186 | udiff_t len; 187 | const tstring& text; 188 | 189 | //initial offset 190 | const udiff_t& offset; 191 | 192 | bool rewind(udiff_t opt = 0) 193 | { 194 | left = offset + opt; 195 | 196 | if(left == _rewound) return false; 197 | _rewound = left; 198 | return true; 199 | } 200 | 201 | #pragma warning(push) 202 | #pragma warning(disable: 26495) 203 | //NOTE: C26495; valid for `roff` 204 | FWord(const tstring& input, const udiff_t& offset) 205 | : found(tstring::npos), offset(offset), left(offset), text(input), len(input.length()) 206 | { 207 | 208 | } 209 | #pragma warning(pop) 210 | 211 | private: 212 | // to detect an unknown looping 213 | udiff_t _rewound; 214 | }; 215 | 216 | /** {word}<- ... ->{word} */ 217 | udiff_t parseInterval(Item& item, FWord& word, const EngineOptions& options); 218 | 219 | /** jump to the next SPLIT block */ 220 | bool jumpRight(Item& item, FWord& word, bool delta = true); 221 | 222 | LoopAct loop(Item& item, FWord& word, const EngineOptions& options); 223 | 224 | private: 225 | 226 | inline bool cmp(const tstring& a, const tstring& b, size_t pos = 0, size_t len = tstring::npos) const; 227 | inline TCHAR getSPChar(const Item& item, const EngineOptions& options) const; 228 | 229 | bool _replace 230 | ( 231 | tstring& input, 232 | const tstring& pattern, 233 | const tstring& replacement, 234 | udiff_t offset, 235 | const EngineOptions& options, 236 | MatchResult& result 237 | ); 238 | 239 | /* EngineOptions::F_MATCH_RESULT -> */ 240 | 241 | inline bool set(MatchResult* result, const EngineOptions& options, udiff_t start, udiff_t end); 242 | inline void reset(MatchResult* result); 243 | inline LoopAct unsetMatch(Item& item); 244 | inline void setStart(Item& item, udiff_t start); 245 | inline void shiftStart(udiff_t start, Item& item); 246 | LoopAct setEnd(Item& item, const FWord& word); 247 | inline bool isOnResult(const MatchResult* result, const EngineOptions& options); 248 | inline bool isEqPrev(const tstring& input, const Item& item, udiff_t len); 249 | inline bool convertToBool(LoopAct act); 250 | 251 | /* <- EngineOptions::F_MATCH_RESULT */ 252 | 253 | inline tstring _lowercase(tstring str) throw() 254 | { 255 | transform(str.begin(), str.end(), str.begin(), __toxlower); 256 | return str; 257 | }; 258 | }; 259 | 260 | }}}}} -------------------------------------------------------------------------------- /regXwild/core/ESS/EngineOptions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2013-2021 Denis Kuzmin github/3F 5 | * Copyright (c) regXwild contributors https://github.com/3F/regXwild 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | 26 | #pragma once 27 | 28 | #include "stdafx.h" 29 | #include "conf.h" 30 | #include "typedefs.h" 31 | 32 | namespace net { namespace r_eg { namespace regXwild { namespace core { namespace ESS 33 | { 34 | using namespace net::r_eg::regXwild::rxwtypes; 35 | 36 | RXW_ENUM_CLASS EngineOptions: flagcfg_t 37 | { 38 | F_NONE = 0, 39 | 40 | /// 41 | /// Ignore case sensitivity when matching. 42 | /// 43 | F_ICASE = 0x001, 44 | 45 | /// 46 | /// Collect additional data for the MatchResult. 47 | /// 48 | F_MATCH_RESULT = 0x002, 49 | 50 | /// 51 | /// Do not finish on first match. 52 | /// 53 | F_MATCH_ALL = 0x004, 54 | 55 | #if _RXW_FEATURE_MATCH_MAP 56 | /// 57 | /// Collect the positions of all occurrences 58 | /// between each presented metasymbol. 59 | /// 60 | F_MATCH_MAP = 0x008, 61 | #endif 62 | 63 | /// 64 | /// Use MS_ANYSP as [^/]* (legacy). 65 | /// Otherwise as [^c]* where `c` is a symbol from the next presented symbol after MS_ANYSP. 66 | /// 67 | F_LEGACY_ANYSP = 0x080, 68 | }; 69 | 70 | #if RXW_CPP11_ENUM_CLASS 71 | 72 | inline flagcfg_t operator& (EngineOptions l, EngineOptions r) 73 | { 74 | return static_cast(l) & static_cast(r); 75 | } 76 | 77 | inline EngineOptions operator| (EngineOptions l, EngineOptions r) 78 | { 79 | return static_cast(static_cast(l) | static_cast(r)); 80 | } 81 | 82 | #endif 83 | 84 | }}}}} -------------------------------------------------------------------------------- /regXwild/core/ESS/LoopAct.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2013-2021 Denis Kuzmin github/3F 5 | * Copyright (c) regXwild contributors https://github.com/3F/regXwild 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | 26 | #pragma once 27 | 28 | #include "stdafx.h" 29 | #include "conf.h" 30 | #include "typedefs.h" 31 | 32 | namespace net { namespace r_eg { namespace regXwild { namespace core { namespace ESS 33 | { 34 | using namespace net::r_eg::regXwild::rxwtypes; 35 | 36 | RXW_ENUM_CLASS LoopAct: flagshort_t 37 | { 38 | Break = 0x01, 39 | Continue = 0x02, 40 | IgnoreLoopExpression = 0x04, 41 | ReturnTrue = 0x08, 42 | ReturnFalse = 0x10, 43 | }; 44 | 45 | #if RXW_CPP11_ENUM_CLASS 46 | 47 | inline flagcfg_t operator& (LoopAct l, LoopAct r) 48 | { 49 | return static_cast(l) & static_cast(r); 50 | } 51 | 52 | inline LoopAct operator| (LoopAct l, LoopAct r) 53 | { 54 | return static_cast(static_cast(l) | static_cast(r)); 55 | } 56 | 57 | #endif 58 | 59 | }}}}} -------------------------------------------------------------------------------- /regXwild/core/ESS/MatchResult.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2013-2021 Denis Kuzmin github/3F 5 | * Copyright (c) regXwild contributors https://github.com/3F/regXwild 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | 26 | #pragma once 27 | 28 | #include "stdafx.h" 29 | #include "conf.h" 30 | #include "typedefs.h" 31 | 32 | namespace net { namespace r_eg { namespace regXwild { namespace core { namespace ESS 33 | { 34 | using namespace net::r_eg::regXwild::rxwtypes; 35 | 36 | struct MatchResult 37 | { 38 | static const udiff_t npos = static_cast(-1); 39 | 40 | /// 41 | /// Position of the first occurrence or MatchResult::npos. 42 | /// It also will be MatchResult::npos if not EngineOptions::F_MATCH_RESULT. 43 | /// 44 | udiff_t start; 45 | 46 | /// 47 | /// Position of the last occurrence. 48 | /// Valid only if `MatchResult::start` != MatchResult::npos. 49 | /// 50 | udiff_t end; 51 | 52 | #if _RXW_FEATURE_MATCH_MAP 53 | /// 54 | /// The positions of all occurrences between each presented metasymbol. 55 | /// Use EngineOptions::F_MATCH_MAP to activate it. 56 | /// 57 | matchmap_t map; 58 | #endif 59 | 60 | #pragma warning(push) 61 | #pragma warning(disable: 26495) 62 | //NOTE: C26495; valid for `start` 63 | MatchResult(): start(npos) 64 | { 65 | 66 | }; 67 | #pragma warning(pop) 68 | }; 69 | 70 | }}}}} -------------------------------------------------------------------------------- /regXwild/core/ESS/def.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2013-2021 Denis Kuzmin github/3F 5 | * Copyright (c) regXwild contributors https://github.com/3F/regXwild 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | 26 | #pragma once 27 | 28 | #include "stdafx.h" 29 | #include "conf.h" 30 | #include "typedefs.h" 31 | 32 | namespace net { namespace r_eg { namespace regXwild { namespace core { namespace ESS 33 | { 34 | using namespace net::r_eg::regXwild::rxwtypes; 35 | 36 | // TODO: consider upgrading to modern enum class 37 | namespace def 38 | { 39 | enum MetaOp: flagmeta_t 40 | { 41 | NONE = 0, 42 | BOL = 0x001, 43 | ANY = 0x002, 44 | SPLIT = 0x004, 45 | ONE = 0x008, 46 | BEGIN = 0x010, 47 | END = 0x020, 48 | MORE = 0x040, 49 | SINGLE = 0x080, 50 | ANYSP = 0x100, 51 | EOL = 0x200, 52 | }; 53 | 54 | enum MetaSymbols 55 | { 56 | MS_ANY = _T('*'), // {0, ~} 57 | MS_SPLIT = _T('|'), // str1 or str2 or ... 58 | MS_ONE = _T('?'), // {0, 1}, ??? {0, 3}, ... 59 | MS_BEGIN = _T('^'), // [str... or [str1... |[str2... 60 | MS_END = _T('$'), // ...str] or ...str1]| ...str2] 61 | MS_MORE = _T('+'), // {1, ~}, +++ {3, ~}, ... 62 | MS_SINGLE = _T('#'), // {1}, ## {2}, ### {3}, ... 63 | MS_ANYSP = _T('>'), // [^/]*str|[^/]*$ (legacy); [^{symbol}]*str|[^{symbol}]*$ for ('>' + {symbol}) 64 | }; 65 | } 66 | 67 | }}}}} -------------------------------------------------------------------------------- /regXwild/core/EXT/AlgorithmExt.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2013-2021 Denis Kuzmin github/3F 5 | * Copyright (c) regXwild contributors https://github.com/3F/regXwild 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | 26 | #include "stdafx.h" 27 | #include "AlgorithmExt.h" 28 | 29 | namespace net { namespace r_eg { namespace regXwild { namespace core { namespace EXT { 30 | 31 | #define WILDCARDS_SYMB_SLASHS _T("\\/") //both 32 | 33 | bool AlgorithmExt::main(const tstring& text, const tstring& filter, bool ignoreCase) 34 | { 35 | if(filter.empty()){ 36 | return true; 37 | } 38 | 39 | tstring _text, _filter; 40 | 41 | if(ignoreCase) { 42 | _text = _lowercase(text); 43 | _filter = _lowercase(filter); //if optimize(to outward): ~18ms 44 | } 45 | else { 46 | _text = text; 47 | _filter = filter; 48 | } 49 | 50 | //split-mode: at least one "|" 51 | bool split = _filter.find(MS_SPLIT) != tstring::npos; //if optimize(to outward): < 1ms 52 | 53 | Item item; 54 | Words words; 55 | 56 | for(tstring::const_iterator it = _filter.begin(), itEnd = _filter.end(); it != itEnd; ++it) 57 | { 58 | ++item.left; 59 | 60 | switch(*it){ 61 | case MS_ANY:{ 62 | item.mask.curr = ANY; 63 | break; 64 | } 65 | case MS_ANYSP:{ 66 | item.mask.curr = ANYSP; 67 | break; 68 | } 69 | case MS_SPLIT:{ 70 | item.mask.curr = SPLIT; 71 | break; 72 | } 73 | case MS_ONE:{ 74 | item.mask.curr = ONE; 75 | break; 76 | } 77 | //case MS_START:{ 78 | // item.mask.curr = START; 79 | // break; 80 | //} 81 | //case MS_END:{ 82 | // item.mask.curr = END; 83 | // break; 84 | //} 85 | default:{ 86 | if(it + 1 == itEnd){ 87 | item.mask.curr = EOL; 88 | ++item.left; 89 | } 90 | else{ 91 | continue; 92 | } 93 | } 94 | } 95 | 96 | if((item.delta = item.left - 1 - item.pos) == 0){ 97 | if(item.mask.curr & SPLIT || item.mask.curr & EOL){ 98 | return true; 99 | } 100 | ++item.pos; 101 | continue; 102 | } 103 | 104 | //getting item 105 | item.curr = _filter.substr(item.pos, item.delta); 106 | 107 | //find a part 108 | words.found = _text.find(item.curr, words.left); 109 | 110 | // working with an interval 111 | if(words.found != tstring::npos){ 112 | // inner placed ~= outer placed ~= outer placed + recommendation to compiler with inner placing (inline) 113 | // ~211ms ~= ~200ms ~= ~208ms :: -_- (average on 110 x (10000 x 300)), see asm instructions 114 | words.found = _handlerInterval(item, words, _text); 115 | } 116 | 117 | // SPLIT control 118 | if(words.found == tstring::npos){ 119 | if(!split || item.mask.curr & EOL){ //TODO: [optimize perfomance]: ...or last block 120 | return false; 121 | } 122 | 123 | item.pos = item.left; 124 | if(item.mask.curr & SPLIT){ 125 | continue; //to next block 126 | } 127 | 128 | // rewind to next block | 129 | item.left = _filter.find(MS_SPLIT, item.left); 130 | if(item.left == tstring::npos){ 131 | return false; //EOL 132 | } 133 | words.left = 0; 134 | it += ++item.left - item.pos; //or overload = 135 | item.pos = item.left; 136 | continue; 137 | } 138 | 139 | // Success: 140 | 141 | if(item.mask.curr & SPLIT || item.mask.curr & EOL){ 142 | return true; 143 | } 144 | 145 | item.pos = item.left; 146 | words.left = words.found + item.delta; 147 | item.mask.prev = item.mask.curr; 148 | item.prev = item.curr; 149 | } 150 | 151 | //after ending iteration 152 | if(item.mask.prev & ANYSP){ // {word}>***??* etc. 153 | if(_text.substr(words.left).find_first_of(WILDCARDS_SYMB_SLASHS) != tstring::npos){ 154 | return false; 155 | } 156 | } 157 | return true; 158 | } 159 | 160 | udiff_t AlgorithmExt::_handlerInterval(Item& item, Words& words, const tstring& text) 161 | { 162 | // "?" 163 | // TODO: [optimize perfomance]: pre-combination - "item?item" 164 | if(item.mask.prev & ONE && (words.found - words.left) != 1) // :: delta -> w?ord 165 | { 166 | udiff_t len = item.prev.length(); 167 | diff_t lPos = words.found - len - 1; 168 | 169 | if(lPos < 0 || text.substr(lPos, len).compare(item.prev) != 0){ 170 | return tstring::npos; 171 | } 172 | return words.found; 173 | } 174 | 175 | // ">" 176 | if(item.mask.prev & ANYSP){ 177 | tstring inside = text.substr(words.left, words.found - words.left); 178 | if(inside.find_first_of(WILDCARDS_SYMB_SLASHS) != tstring::npos){ // < ~1ms; comparison with: '\\' -> '/' + find() ~= 3-4ms 179 | return tstring::npos; 180 | } 181 | return words.found; 182 | } 183 | 184 | //.... 185 | return words.found; 186 | } 187 | 188 | }}}}} 189 | -------------------------------------------------------------------------------- /regXwild/core/EXT/AlgorithmExt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2013-2021 Denis Kuzmin github/3F 5 | * Copyright (c) regXwild contributors https://github.com/3F/regXwild 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | 26 | #pragma once 27 | 28 | #include "stdafx.h" 29 | #include "conf.h" 30 | #include "typedefs.h" 31 | 32 | namespace net { namespace r_eg { namespace regXwild { namespace core { namespace EXT { 33 | 34 | using namespace net::r_eg::regXwild::rxwtypes; 35 | 36 | class AlgorithmExt 37 | { 38 | public: 39 | 40 | // TODO: consider upgrading to modern enum class or enum struct 41 | enum MetaOperation 42 | { 43 | FLUSH = 0, 44 | ANY = 1, 45 | ANYSP = 2, 46 | SPLIT = 4, 47 | ONE = 8, 48 | START = 16, 49 | END = 32, 50 | EOL = 64, 51 | }; 52 | 53 | // TODO: consider upgrading to modern enum class or enum struct 54 | enum MetaSymbols 55 | { 56 | MS_ANY = _T('*'), 57 | MS_ANYSP = _T('>'), //as [^/\\]+ 58 | MS_SPLIT = _T('|'), 59 | MS_ONE = _T('?'), 60 | MS_START = _T('^'), 61 | MS_END = _T('$'), 62 | }; 63 | 64 | REGXWILD_API bool main(const tstring& text, const tstring& filter, bool ignoreCase); 65 | 66 | protected: 67 | 68 | struct Mask 69 | { 70 | MetaOperation curr; 71 | MetaOperation prev; 72 | #pragma warning(push) 73 | #pragma warning(disable: 26812) // EXT version more probably will not be upgraded to enum class 74 | Mask(): curr(FLUSH), prev(FLUSH) { }; 75 | #pragma warning(pop) 76 | }; 77 | 78 | /** 79 | * to wildcards 80 | */ 81 | struct Item 82 | { 83 | tstring curr; 84 | udiff_t pos; 85 | udiff_t left; 86 | udiff_t delta; 87 | Mask mask; 88 | tstring prev; 89 | Item(): pos(0), left(0), delta(0) { }; 90 | }; 91 | 92 | /** 93 | * to words 94 | */ 95 | struct Words 96 | { 97 | udiff_t found; 98 | udiff_t left; 99 | 100 | #pragma warning(push) 101 | #pragma warning(disable: 26495) 102 | Words(): left(0) { }; 103 | #pragma warning(pop) 104 | }; 105 | 106 | /** 107 | * Working with an interval: 108 | * _______ 109 | * {word} ... {word} 110 | */ 111 | udiff_t _handlerInterval(Item& item, Words& words, const tstring& text); 112 | 113 | private: 114 | 115 | inline tstring _lowercase(tstring str) throw() 116 | { 117 | transform(str.begin(), str.end(), str.begin(), __toxlower); 118 | return str; 119 | }; 120 | }; 121 | 122 | }}}}} -------------------------------------------------------------------------------- /regXwild/declspec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2013-2021 Denis Kuzmin github/3F 5 | * Copyright (c) regXwild contributors https://github.com/3F/regXwild 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | 26 | #pragma once 27 | #ifndef _RXW_DECLSPEC_ 28 | #define _RXW_DECLSPEC_ 29 | 30 | #ifdef REGXWILD_AS_LIB 31 | 32 | #ifdef REGXWILD_EXPORTS 33 | 34 | #define REGXWILD_API __declspec(dllexport) 35 | 36 | #else 37 | 38 | #define REGXWILD_API __declspec(dllimport) 39 | 40 | #endif 41 | 42 | #define REGXWILD_API_L TLINKAGE REGXWILD_API 43 | 44 | #else 45 | 46 | #define REGXWILD_API 47 | #define REGXWILD_API_L TLINKAGE 48 | 49 | #endif 50 | 51 | #endif // _RXW_DECLSPEC_ -------------------------------------------------------------------------------- /regXwild/dllmain.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2013-2021 Denis Kuzmin github/3F 5 | * Copyright (c) regXwild contributors https://github.com/3F/regXwild 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | 26 | #include "stdafx.h" 27 | 28 | // WinAPI Entry point 29 | BOOL APIENTRY DllMain( HMODULE hModule, 30 | DWORD ul_reason_for_call, 31 | LPVOID lpReserved 32 | ) 33 | { 34 | switch (ul_reason_for_call) 35 | { 36 | case DLL_PROCESS_ATTACH: 37 | case DLL_THREAD_ATTACH: 38 | case DLL_THREAD_DETACH: 39 | case DLL_PROCESS_DETACH: 40 | break; 41 | } 42 | return TRUE; 43 | } 44 | 45 | -------------------------------------------------------------------------------- /regXwild/regXwild.common.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2013-2021 Denis Kuzmin github/3F 5 | * Copyright (c) regXwild contributors https://github.com/3F/regXwild 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | 26 | #include "stdafx.h" 27 | #include "regXwild.h" 28 | #include "regXwild.common.h" 29 | #include "core\ESS\AlgorithmEss.h" 30 | #include "core\EXT\AlgorithmExt.h" 31 | 32 | namespace net { namespace r_eg { namespace regXwild { namespace common 33 | { 34 | /// 35 | /// In a specified input, replaces first substring that match a specified pattern with a specified replacement string. 36 | /// 37 | /// 38 | /// The input string that will be modified if matched. 39 | /// Allocated memory must be enough for modified result. 40 | /// 41 | /// Compatible pattern to match. 42 | /// The replacement string. 43 | /// A bitwise combination of the enumeration values that provide options for matching or modifications. 44 | /// True if the match was successful. 45 | REGXWILD_API_L bool replace 46 | ( 47 | rxwtypes::TCHAR* input, 48 | const rxwtypes::TCHAR* pattern, 49 | const rxwtypes::TCHAR* replacement, 50 | rxwtypes::flagcfg_t options 51 | ) 52 | { 53 | return replaceOfs(input, pattern, replacement, 0, options); 54 | } 55 | 56 | /// 57 | /// In a specified input, replaces first substring that match a specified pattern with a specified replacement string. 58 | /// 59 | /// 60 | /// The input string that will be modified if matched. 61 | /// Allocated memory must be enough for modified result. 62 | /// 63 | /// Compatible pattern to match. 64 | /// The replacement string. 65 | /// The starting position to start matching. 66 | /// A bitwise combination of the enumeration values that provide options for matching or modifications. 67 | /// True if the match was successful. 68 | REGXWILD_API_L inline bool replaceOfs 69 | ( 70 | rxwtypes::TCHAR* input, 71 | const rxwtypes::TCHAR* pattern, 72 | const rxwtypes::TCHAR* replacement, 73 | rxwtypes::udiff_t offset, 74 | rxwtypes::flagcfg_t options 75 | ) 76 | { 77 | if(input == nullptr) return false; 78 | 79 | EssRxW rxw; 80 | rxwtypes::tstring _input = rxwtypes::tstring(input); 81 | 82 | if(!rxw.replace(_input, pattern, replacement, offset, static_cast(options))) { 83 | return false; 84 | } 85 | 86 | std::copy(_input.begin(), _input.end(), input); 87 | input[_input.length()] = '\0'; 88 | 89 | return true; 90 | } 91 | 92 | /// 93 | /// Searches an input string for a substring that matches a pattern. 94 | /// 95 | /// The string to search for a match. 96 | /// Compatible pattern to match. 97 | /// A bitwise combination of the enumeration values that provide options for matching. 98 | /// Information about the match. 99 | /// True if the match was successful. 100 | REGXWILD_API_L bool match 101 | ( 102 | const rxwtypes::TCHAR* input, 103 | const rxwtypes::TCHAR* pattern, 104 | rxwtypes::flagcfg_t options, 105 | EssRxW::MatchResult* result 106 | ) 107 | { 108 | return matchOfs(input, pattern, 0, options, result); 109 | } 110 | 111 | /// 112 | /// Searches an input string for a substring that matches a pattern. 113 | /// 114 | /// The string to search for a match. 115 | /// Compatible pattern to match. 116 | /// The starting position to start matching. 117 | /// A bitwise combination of the enumeration values that provide options for matching. 118 | /// Information about the match. 119 | /// True if the match was successful. 120 | REGXWILD_API_L inline bool matchOfs 121 | ( 122 | const rxwtypes::TCHAR* input, 123 | const rxwtypes::TCHAR* pattern, 124 | rxwtypes::udiff_t offset, 125 | rxwtypes::flagcfg_t options, 126 | EssRxW::MatchResult* result 127 | ) 128 | { 129 | EssRxW rxw; 130 | return rxw.match(input, pattern, offset, static_cast(options), result); 131 | } 132 | 133 | /// 134 | /// In a specified input, replaces first substring that match a specified pattern with a specified replacement string. 135 | /// 136 | /// The string to search for a match. 137 | /// Compatible pattern to match. 138 | /// The replacement string. 139 | /// Output string using pre-allocated memory if the match was successful, or null. 140 | /// The starting position to start matching. 141 | /// A bitwise combination of the enumeration values that provide options for matching or modifications. 142 | /// True if the match was successful. 143 | REGXWILD_API_L bool replaceTo 144 | ( 145 | const rxwtypes::TCHAR* input, 146 | const rxwtypes::TCHAR* pattern, 147 | const rxwtypes::TCHAR* replacement, 148 | rxwtypes::TCHAR* to, 149 | rxwtypes::udiff_t offset, 150 | rxwtypes::flagcfg_t options 151 | ) 152 | { 153 | if(input == nullptr) return false; 154 | 155 | EssRxW rxw; 156 | rxwtypes::tstring _input = rxwtypes::tstring(input); 157 | 158 | if(!rxw.replace(_input, pattern, replacement, offset, static_cast(options))) { 159 | return false; 160 | } 161 | 162 | if(to == nullptr) return true; 163 | 164 | std::copy(_input.begin(), _input.end(), to); 165 | to[_input.length()] = '\0'; 166 | 167 | return true; 168 | } 169 | 170 | /** 171 | * To search substring in data with filter by the rules of ESS algorithm. 172 | * [char* / wchar_t*] 173 | * @param data Where to search. 174 | * @param filter The filter of comparison string. 175 | * @param ignoreCase To check data with no case sensitive rules if true. 176 | * @return Returns true value if the data satisfies the condition of the filter. 177 | */ 178 | REGXWILD_API_L bool searchEssC(const rxwtypes::TCHAR* data, const rxwtypes::TCHAR* filter, bool ignoreCase) 179 | { 180 | return searchEss(data, filter, ignoreCase); 181 | } 182 | 183 | /** 184 | * To search substring in data with filter by the rules of ESS algorithm. 185 | * [string& / wstring&] 186 | * @param data Where to search. 187 | * @param filter The filter of comparison string. 188 | * @param ignoreCase To check data with no case sensitive rules if true. 189 | * @return Returns true value if the data satisfies the condition of the filter. 190 | */ 191 | REGXWILD_API_L bool searchEss(const rxwtypes::tstring& data, const rxwtypes::tstring& filter, bool ignoreCase) 192 | { 193 | core::ESS::AlgorithmEss alg; 194 | 195 | return alg.search(data, filter, ignoreCase); 196 | } 197 | 198 | /** 199 | * To search substring in data with filter by the rules of ESS algorithm. 200 | * [string* / wstring*] 201 | * @param data Where to search. 202 | * @param filter The filter of comparison string. 203 | * @param ignoreCase To check data with no case sensitive rules if true. 204 | * @return Returns true value if the data satisfies the condition of the filter. 205 | */ 206 | REGXWILD_API_L bool searchEssPtr(const rxwtypes::tstring* data, const rxwtypes::tstring* filter, bool ignoreCase) 207 | { 208 | return searchEss(*data, *filter, ignoreCase); 209 | } 210 | 211 | /** 212 | * To search substring in data with filter by the rules of EXT algorithm. 213 | * [char* / wchar_t*] 214 | * @param data Where to search. 215 | * @param filter The filter of comparison string. 216 | * @param ignoreCase To check data with no case sensitive rules if true. 217 | * @return Returns true value if the data satisfies the condition of the filter. 218 | */ 219 | REGXWILD_API_L bool searchExtC(const rxwtypes::TCHAR* data, const rxwtypes::TCHAR* filter, bool ignoreCase) 220 | { 221 | return searchExt(data, filter, ignoreCase); 222 | } 223 | 224 | /** 225 | * To search substring in data with filter by the rules of EXT algorithm. 226 | * [string& / wstring&] 227 | * @param data Where to search. 228 | * @param filter The filter of comparison string. 229 | * @param ignoreCase To check data with no case sensitive rules if true. 230 | * @return Returns true value if the data satisfies the condition of the filter. 231 | */ 232 | REGXWILD_API_L bool searchExt(const rxwtypes::tstring& data, const rxwtypes::tstring& filter, bool ignoreCase) 233 | { 234 | core::EXT::AlgorithmExt alg; 235 | 236 | return alg.main(data, filter, ignoreCase); 237 | } 238 | 239 | /** 240 | * To search substring in data with filter by the rules of EXT algorithm. 241 | * [string* / wstring*] 242 | * @param data Where to search. 243 | * @param filter The filter of comparison string. 244 | * @param ignoreCase To check data with no case sensitive rules if true. 245 | * @return Returns true value if the data satisfies the condition of the filter. 246 | */ 247 | REGXWILD_API_L bool searchExtPtr(const rxwtypes::tstring* data, const rxwtypes::tstring* filter, bool ignoreCase) 248 | { 249 | return searchExt(*data, *filter, ignoreCase); 250 | } 251 | 252 | /** 253 | * obsolete due to RXWVersion 254 | * @return Returns current RXWVersion.product version of regXwild library. 255 | */ 256 | REGXWILD_API_L const rxwtypes::TCHAR* versionString() 257 | { 258 | return /*vsSBE*/_T("1.4.0"); 259 | } 260 | 261 | }}}} -------------------------------------------------------------------------------- /regXwild/regXwild.common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2013-2021 Denis Kuzmin github/3F 5 | * Copyright (c) regXwild contributors https://github.com/3F/regXwild 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | 26 | #pragma once 27 | 28 | #include "regXwild.h" 29 | 30 | namespace net { namespace r_eg { namespace regXwild { namespace common 31 | { 32 | /// 33 | /// In a specified input, replaces first substring that match a specified pattern with a specified replacement string. 34 | /// 35 | /// 36 | /// The input string that will be modified if matched. 37 | /// Allocated memory must be enough for modified result. 38 | /// 39 | /// Compatible pattern to match. 40 | /// The replacement string. 41 | /// A bitwise combination of the enumeration values that provide options for matching or modifications. 42 | /// True if the match was successful. 43 | REGXWILD_API_L bool replace 44 | ( 45 | rxwtypes::TCHAR* input, 46 | const rxwtypes::TCHAR* pattern, 47 | const rxwtypes::TCHAR* replacement, 48 | rxwtypes::flagcfg_t options = 0 49 | ); 50 | 51 | /// 52 | /// In a specified input, replaces first substring that match a specified pattern with a specified replacement string. 53 | /// 54 | /// 55 | /// The input string that will be modified if matched. 56 | /// Allocated memory must be enough for modified result. 57 | /// 58 | /// Compatible pattern to match. 59 | /// The replacement string. 60 | /// The starting position to start matching. 61 | /// A bitwise combination of the enumeration values that provide options for matching or modifications. 62 | /// True if the match was successful. 63 | REGXWILD_API_L bool replaceOfs 64 | ( 65 | rxwtypes::TCHAR* input, 66 | const rxwtypes::TCHAR* pattern, 67 | const rxwtypes::TCHAR* replacement, 68 | rxwtypes::udiff_t offset = 0, 69 | rxwtypes::flagcfg_t options = 0 70 | ); 71 | 72 | /// 73 | /// Searches an input string for a substring that matches a pattern. 74 | /// 75 | /// The string to search for a match. 76 | /// Compatible pattern to match. 77 | /// A bitwise combination of the enumeration values that provide options for matching. 78 | /// Information about the match. 79 | /// True if the match was successful. 80 | REGXWILD_API_L bool match 81 | ( 82 | const rxwtypes::TCHAR* input, 83 | const rxwtypes::TCHAR* pattern, 84 | rxwtypes::flagcfg_t options = 0, 85 | EssRxW::MatchResult* result = nullptr 86 | ); 87 | 88 | /// 89 | /// Searches an input string for a substring that matches a pattern. 90 | /// 91 | /// The string to search for a match. 92 | /// Compatible pattern to match. 93 | /// The starting position to start matching. 94 | /// A bitwise combination of the enumeration values that provide options for matching. 95 | /// Information about the match. 96 | /// True if the match was successful. 97 | REGXWILD_API_L bool matchOfs 98 | ( 99 | const rxwtypes::TCHAR* input, 100 | const rxwtypes::TCHAR* pattern, 101 | rxwtypes::udiff_t offset = 0, 102 | rxwtypes::flagcfg_t options = 0, 103 | EssRxW::MatchResult* result = nullptr 104 | ); 105 | 106 | /// 107 | /// In a specified input, replaces first substring that match a specified pattern with a specified replacement string. 108 | /// 109 | /// The string to search for a match. 110 | /// Compatible pattern to match. 111 | /// The replacement string. 112 | /// Output string using pre-allocated memory if the match was successful, or null. 113 | /// The starting position to start matching. 114 | /// A bitwise combination of the enumeration values that provide options for matching or modifications. 115 | /// True if the match was successful. 116 | REGXWILD_API_L bool replaceTo 117 | ( 118 | const rxwtypes::TCHAR* input, 119 | const rxwtypes::TCHAR* pattern, 120 | const rxwtypes::TCHAR* replacement, 121 | rxwtypes::TCHAR* to, 122 | rxwtypes::udiff_t offset = 0, 123 | rxwtypes::flagcfg_t options = 0 124 | ); 125 | 126 | /** 127 | * To search substring in data with filter by the rules of ESS algorithm. 128 | * [char* / wchar_t*] 129 | * @param data Where to search. 130 | * @param filter The filter of comparison string. 131 | * @param ignoreCase To check data with no case sensitive rules if true. 132 | * @return Returns true value if the data satisfies the condition of the filter. 133 | */ 134 | REGXWILD_API_L bool searchEssC(const rxwtypes::TCHAR* data, const rxwtypes::TCHAR* filter, bool ignoreCase); 135 | 136 | /** 137 | * To search substring in data with filter by the rules of ESS algorithm. 138 | * [string& / wstring&] 139 | * @param data Where to search. 140 | * @param filter The filter of comparison string. 141 | * @param ignoreCase To check data with no case sensitive rules if true. 142 | * @return Returns true value if the data satisfies the condition of the filter. 143 | */ 144 | REGXWILD_API_L bool searchEss(const rxwtypes::tstring& data, const rxwtypes::tstring& filter, bool ignoreCase); 145 | 146 | /** 147 | * To search substring in data with filter by the rules of ESS algorithm. 148 | * [string* / wstring*] 149 | * @param data Where to search. 150 | * @param filter The filter of comparison string. 151 | * @param ignoreCase To check data with no case sensitive rules if true. 152 | * @return Returns true value if the data satisfies the condition of the filter. 153 | */ 154 | REGXWILD_API_L bool searchEssPtr(const rxwtypes::tstring* data, const rxwtypes::tstring* filter, bool ignoreCase); 155 | 156 | /** 157 | * To search substring in data with filter by the rules of EXT algorithm. 158 | * [char* / wchar_t*] 159 | * @param data Where to search. 160 | * @param filter The filter of comparison string. 161 | * @param ignoreCase To check data with no case sensitive rules if true. 162 | * @return Returns true value if the data satisfies the condition of the filter. 163 | */ 164 | REGXWILD_API_L bool searchExtC(const rxwtypes::TCHAR* data, const rxwtypes::TCHAR* filter, bool ignoreCase); 165 | 166 | /** 167 | * To search substring in data with filter by the rules of EXT algorithm. 168 | * [string& / wstring&] 169 | * @param data Where to search. 170 | * @param filter The filter of comparison string. 171 | * @param ignoreCase To check data with no case sensitive rules if true. 172 | * @return Returns true value if the data satisfies the condition of the filter. 173 | */ 174 | REGXWILD_API_L bool searchExt(const rxwtypes::tstring& data, const rxwtypes::tstring& filter, bool ignoreCase); 175 | 176 | /** 177 | * To search substring in data with filter by the rules of EXT algorithm. 178 | * [string* / wstring*] 179 | * @param data Where to search. 180 | * @param filter The filter of comparison string. 181 | * @param ignoreCase To check data with no case sensitive rules if true. 182 | * @return Returns true value if the data satisfies the condition of the filter. 183 | */ 184 | REGXWILD_API_L bool searchExtPtr(const rxwtypes::tstring* data, const rxwtypes::tstring* filter, bool ignoreCase); 185 | 186 | /** 187 | * To get current version of regXwild library as a string. 188 | * @return Returns version as Major.Minor [.Revision] etc. 189 | */ 190 | REGXWILD_API_L const rxwtypes::TCHAR* versionString(); 191 | 192 | }}}} -------------------------------------------------------------------------------- /regXwild/regXwild.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2013-2021 Denis Kuzmin github/3F 5 | * Copyright (c) regXwild contributors https://github.com/3F/regXwild 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | 26 | #include "stdafx.h" 27 | #include "regXwild.h" 28 | 29 | namespace net { namespace r_eg { namespace regXwild 30 | { 31 | 32 | }}} -------------------------------------------------------------------------------- /regXwild/regXwild.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2013-2021 Denis Kuzmin github/3F 5 | * Copyright (c) regXwild contributors https://github.com/3F/regXwild 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | 26 | #pragma once 27 | 28 | #include "stdafx.h" 29 | #include "conf.h" 30 | #include "typedefs.h" 31 | #include "RXWVersion.h" 32 | 33 | #include "./core/EXT/AlgorithmExt.h" 34 | #include "./core/ESS/AlgorithmEss.h" 35 | 36 | namespace net { namespace r_eg { namespace regXwild 37 | { 38 | /// 39 | /// ESS version (advanced EXT version). 40 | /// 41 | typedef core::ESS::AlgorithmEss EssRxW; 42 | 43 | /// 44 | /// Leading implementation for regXwild. 45 | /// 46 | typedef EssRxW RxW; 47 | typedef core::ESS::EngineOptions FlagsRxW; 48 | typedef core::ESS::MatchResult MatchRxW; 49 | 50 | /// 51 | /// EXT version (more simplified than ESS). 52 | /// 53 | typedef core::EXT::AlgorithmExt ExtRxW; 54 | }}} -------------------------------------------------------------------------------- /regXwild/regXwild.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include "winres.h" 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | #undef APSTUDIO_READONLY_SYMBOLS 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // Russian (Russia) resources 17 | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS) 19 | LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT 20 | #pragma code_page(1251) 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | #endif // Russian (Russia) resources 48 | ///////////////////////////////////////////////////////////////////////////// 49 | 50 | 51 | ///////////////////////////////////////////////////////////////////////////// 52 | // English (United States) resources 53 | 54 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 55 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 56 | #pragma code_page(1252) 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // 60 | // Version 61 | // 62 | 63 | VS_VERSION_INFO VERSIONINFO 64 | FILEVERSION 1,4,0,0 65 | PRODUCTVERSION 1,4,0,0 66 | FILEFLAGSMASK 0x3fL 67 | #ifdef _DEBUG 68 | FILEFLAGS 0x1L 69 | #else 70 | FILEFLAGS 0x0L 71 | #endif 72 | FILEOS 0x40000L 73 | FILETYPE 0x2L 74 | FILESUBTYPE 0x0L 75 | BEGIN 76 | BLOCK "StringFileInfo" 77 | BEGIN 78 | BLOCK "040904b0" 79 | BEGIN 80 | VALUE "CompanyName", "github.com/3F" 81 | VALUE "FileDescription", "https://github.com/3F/regXwild" 82 | VALUE "FileVersion", "1.4.0.0" 83 | VALUE "InternalName", "regXwild.dll" 84 | VALUE "LegalCopyright", "Copyright (c) 2013-2021 Denis Kuzmin github/3F" 85 | VALUE "OriginalFilename", "regXwild.dll" 86 | VALUE "ProductName", "regXwild" 87 | VALUE "ProductVersion", "1.4.0" 88 | END 89 | END 90 | BLOCK "VarFileInfo" 91 | BEGIN 92 | VALUE "Translation", 0x409, 1200 93 | END 94 | END 95 | 96 | #endif // English (United States) resources 97 | ///////////////////////////////////////////////////////////////////////////// 98 | 99 | 100 | 101 | #ifndef APSTUDIO_INVOKED 102 | ///////////////////////////////////////////////////////////////////////////// 103 | // 104 | // Generated from the TEXTINCLUDE 3 resource. 105 | // 106 | 107 | 108 | ///////////////////////////////////////////////////////////////////////////// 109 | #endif // not APSTUDIO_INVOKED 110 | 111 | -------------------------------------------------------------------------------- /regXwild/regXwild.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | Debug 7 | Win32 8 | 9 | 10 | Release 11 | Win32 12 | 13 | 14 | Debug 15 | x64 16 | 17 | 18 | Release 19 | x64 20 | 21 | 22 | 23 | {74660324-42AA-41B6-9FDB-E0ED0D0144CE} 24 | Win32Proj 25 | net::r_eg::regXwild 26 | v$(VisualStudioVersion.Replace(".", "")) 27 | v141 28 | v142 29 | $(LatestTargetPlatformVersion) 30 | 10.0 31 | 32 | 33 | 34 | DynamicLibrary 35 | true 36 | 37 | 38 | DynamicLibrary 39 | false 40 | true 41 | 42 | 43 | DynamicLibrary 44 | true 45 | 46 | 47 | DynamicLibrary 48 | false 49 | true 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | true 71 | $(ProjectDir);$(IncludePath) 72 | 73 | 74 | true 75 | $(ProjectDir);$(IncludePath) 76 | 77 | 78 | false 79 | $(ProjectDir);$(IncludePath) 80 | 81 | 82 | false 83 | $(ProjectDir);$(IncludePath) 84 | 85 | 86 | 87 | Use 88 | Level3 89 | Disabled 90 | RXW_NO_NDEBUG_STRING;REGXWILD_COMPILE_PCH;WIN32;_DEBUG;_WINDOWS;_USRDLL;REGXWILD_AS_LIB;REGXWILD_EXPORTS;%(PreprocessorDefinitions) 91 | true 92 | 93 | 94 | Windows 95 | true 96 | 97 | 98 | 99 | 100 | Use 101 | Level3 102 | Disabled 103 | RXW_NO_NDEBUG_STRING;REGXWILD_COMPILE_PCH;_DEBUG;_WINDOWS;_USRDLL;REGXWILD_AS_LIB;REGXWILD_EXPORTS;%(PreprocessorDefinitions) 104 | true 105 | 106 | 107 | Windows 108 | true 109 | 110 | 111 | 112 | 113 | Level3 114 | Use 115 | MaxSpeed 116 | true 117 | true 118 | REGXWILD_COMPILE_PCH;WIN32;NDEBUG;_WINDOWS;_USRDLL;REGXWILD_AS_LIB;REGXWILD_EXPORTS;%(PreprocessorDefinitions) 119 | true 120 | 121 | 122 | Windows 123 | true 124 | true 125 | true 126 | 127 | 128 | 129 | 130 | Level3 131 | Use 132 | MaxSpeed 133 | true 134 | true 135 | REGXWILD_COMPILE_PCH;NDEBUG;_WINDOWS;_USRDLL;REGXWILD_AS_LIB;REGXWILD_EXPORTS;%(PreprocessorDefinitions) 136 | true 137 | 138 | 139 | Windows 140 | true 141 | true 142 | true 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | false 168 | 169 | 170 | false 171 | 172 | 173 | false 174 | 175 | 176 | false 177 | 178 | 179 | 180 | 181 | 182 | 183 | Create 184 | Create 185 | Create 186 | Create 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | -------------------------------------------------------------------------------- /regXwild/regXwild.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {482adaa7-cd8a-4b21-adb6-4639ef68aa6f} 18 | 19 | 20 | {886c2a10-d651-4497-af13-a6b0bdeeaa7f} 21 | 22 | 23 | {eebd350d-0765-4329-871e-e33453bebda0} 24 | 25 | 26 | {b886227e-83cf-47a6-a990-23691b36bbdb} 27 | 28 | 29 | {b1c52020-66cd-413c-9f86-4e0dffe8f982} 30 | 31 | 32 | {da4fad56-4e17-4b9c-b598-379d25b8aaf3} 33 | 34 | 35 | 36 | 37 | Header Files 38 | 39 | 40 | Header Files 41 | 42 | 43 | Header Files 44 | 45 | 46 | Header Files 47 | 48 | 49 | Header Files 50 | 51 | 52 | Header Files 53 | 54 | 55 | Header Files\core\ESS 56 | 57 | 58 | Header Files\core\EXT 59 | 60 | 61 | Header Files 62 | 63 | 64 | Header Files 65 | 66 | 67 | Header Files 68 | 69 | 70 | Header Files\core\ESS 71 | 72 | 73 | Header Files\core\ESS 74 | 75 | 76 | Header Files\core\ESS 77 | 78 | 79 | Header Files\core\ESS 80 | 81 | 82 | Header Files 83 | 84 | 85 | 86 | 87 | Source Files 88 | 89 | 90 | Source Files 91 | 92 | 93 | Source Files 94 | 95 | 96 | Source Files\core\ESS 97 | 98 | 99 | Source Files\core\EXT 100 | 101 | 102 | Source Files 103 | 104 | 105 | 106 | 107 | Resource Files 108 | 109 | 110 | -------------------------------------------------------------------------------- /regXwild/regXwildAPI.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2013-2021 Denis Kuzmin github/3F 5 | * Copyright (c) regXwild contributors https://github.com/3F/regXwild 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | 26 | #pragma once 27 | 28 | #include "regXwild.common.h" 29 | using namespace net::r_eg::regXwild::common; -------------------------------------------------------------------------------- /regXwild/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by regXwild.rc 4 | 5 | // Next default values for new objects 6 | // 7 | #ifdef APSTUDIO_INVOKED 8 | #ifndef APSTUDIO_READONLY_SYMBOLS 9 | #define _APS_NEXT_RESOURCE_VALUE 101 10 | #define _APS_NEXT_COMMAND_VALUE 40001 11 | #define _APS_NEXT_CONTROL_VALUE 1001 12 | #define _APS_NEXT_SYMED_VALUE 101 13 | #endif 14 | #endif 15 | -------------------------------------------------------------------------------- /regXwild/stdafx.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2013-2021 Denis Kuzmin github/3F 5 | * Copyright (c) regXwild contributors https://github.com/3F/regXwild 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | 26 | // regXwild.pch will be the pre-compiled header 27 | // stdafx.obj will contain the pre-compiled type information 28 | 29 | #include "stdafx.h" -------------------------------------------------------------------------------- /regXwild/stdafx.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2013-2021 Denis Kuzmin github/3F 5 | * Copyright (c) regXwild contributors https://github.com/3F/regXwild 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | 26 | #pragma once 27 | #ifndef _RXW_STDAFX_ 28 | #define _RXW_STDAFX_ 29 | 30 | // L-42, helps to avoid std::length_error (or like) when Release <-> Debug 31 | // This, however, will not resolve the case when user includes (or iostream, etc) manually 32 | // because the definitions may differ from the compiled module as compared to the end user environment. 33 | #ifndef RXW_NO_NDEBUG_STRING 34 | 35 | #if _DEBUG 36 | #define __DEBUG_USR_D 1 37 | #undef _DEBUG 38 | #endif 39 | 40 | #ifndef NDEBUG 41 | #define _NDEBUG_USR_D 1 42 | #define NDEBUG 1 43 | #endif 44 | 45 | #include 46 | 47 | #if _NDEBUG_USR_D 48 | #undef NDEBUG 49 | #undef _NDEBUG_USR_D 50 | #endif 51 | 52 | #if __DEBUG_USR_D 53 | #define _DEBUG 1 54 | #undef __DEBUG_USR_D 55 | #endif 56 | 57 | #else 58 | 59 | #include 60 | 61 | #endif 62 | 63 | 64 | // For transform() in internal _lowercase processing 65 | #include 66 | 67 | #if _RXW_FEATURE_MATCH_MAP 68 | 69 | // ESS F_MATCH_MAP 70 | #include 71 | 72 | #endif 73 | 74 | #if REGXWILD_COMPILE_PCH 75 | 76 | // Exclude rarely-used stuff from Windows headers 77 | #define WIN32_LEAN_AND_MEAN 78 | 79 | #include "targetver.h" 80 | 81 | // Only for DllMain 82 | #include 83 | 84 | #endif 85 | 86 | #endif // _RXW_STDAFX_ -------------------------------------------------------------------------------- /regXwild/targetver.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2013-2021 Denis Kuzmin github/3F 5 | * Copyright (c) regXwild contributors https://github.com/3F/regXwild 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | 26 | #pragma once 27 | 28 | // Including SDKDDKVer.h defines the highest available Windows platform. 29 | 30 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 31 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 32 | 33 | #include 34 | -------------------------------------------------------------------------------- /regXwild/typedefs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2013-2021 Denis Kuzmin github/3F 5 | * Copyright (c) regXwild contributors https://github.com/3F/regXwild 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | 26 | #pragma once 27 | #ifndef _RXW_TYPEDEFS_ 28 | #define _RXW_TYPEDEFS_ 29 | 30 | #include "stdafx.h" 31 | 32 | namespace net { namespace r_eg { namespace regXwild { namespace rxwtypes 33 | { 34 | 35 | #ifdef RXW_UNICODE 36 | 37 | typedef std::wstring tstring; 38 | #define __toxlower towlower 39 | 40 | typedef wchar_t TCHAR; 41 | #ifndef _T 42 | #define _T(x) L ## x 43 | #endif // !_T 44 | 45 | #else 46 | 47 | typedef std::string tstring; 48 | #define __toxlower tolower 49 | 50 | typedef char TCHAR; 51 | #ifndef _T 52 | #define _T(x) x 53 | #endif // !_T 54 | 55 | #endif 56 | 57 | typedef size_t udiff_t; 58 | typedef ptrdiff_t diff_t; 59 | 60 | typedef unsigned int flagmeta_t; 61 | typedef unsigned int flagcfg_t; 62 | typedef unsigned char flagshort_t; 63 | 64 | #if _RXW_FEATURE_MATCH_MAP 65 | typedef std::vector matchmap_t; 66 | #endif 67 | 68 | }}}} 69 | 70 | #endif // _RXW_TYPEDEFS_ -------------------------------------------------------------------------------- /regXwildTest/EssFlagICASETest.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "CppUnitTest.h" 3 | 4 | #include "..\regXwild\regXwild.h" 5 | 6 | using namespace Microsoft::VisualStudio::CppUnitTestFramework; 7 | using namespace net::r_eg::regXwild; 8 | 9 | namespace regXwildTest 10 | { 11 | TEST_CLASS(EssFlagICASETest) 12 | { 13 | public: 14 | 15 | void uMatchTest1Set(const EssRxW::EngineOptions& cfg) 16 | { 17 | Assert::AreEqual(false, rxw.match(_T("system"), _T("syStem"), cfg)); 18 | Assert::AreEqual(true, rxw.match(_T("system"), _T("system"), cfg)); 19 | Assert::AreEqual(false, rxw.match(_T("syStem"), _T("system"), cfg)); 20 | Assert::AreEqual(true, rxw.match(_T("SYSTEM"), _T("SYSTEM"), cfg)); 21 | 22 | Assert::AreEqual(false, rxw.match(_T("system"), _T("sy*Stem"), cfg)); 23 | Assert::AreEqual(false, rxw.match(_T("system"), _T("syS*tem"), cfg)); 24 | Assert::AreEqual(true, rxw.match(_T("system"), _T("sy*stem"), cfg)); 25 | } 26 | 27 | TEST_METHOD(uMatchTest1) 28 | { 29 | uMatchTest1Set(EssRxW::EngineOptions::F_NONE); 30 | uMatchTest1Set(EssRxW::EngineOptions::F_LEGACY_ANYSP | EssRxW::EngineOptions::F_MATCH_RESULT); 31 | } 32 | 33 | void uMatchTest2Set(const EssRxW::EngineOptions& cfg) 34 | { 35 | Assert::AreEqual(true, rxw.match(_T("system"), _T("syStem"), cfg)); 36 | Assert::AreEqual(true, rxw.match(_T("system"), _T("system"), cfg)); 37 | Assert::AreEqual(true, rxw.match(_T("syStem"), _T("system"), cfg)); 38 | Assert::AreEqual(true, rxw.match(_T("SYSTEM"), _T("SYSTEM"), cfg)); 39 | 40 | Assert::AreEqual(true, rxw.match(_T("system"), _T("sy*Stem"), cfg)); 41 | Assert::AreEqual(true, rxw.match(_T("system"), _T("syS*tem"), cfg)); 42 | Assert::AreEqual(true, rxw.match(_T("system"), _T("sy*stem"), cfg)); 43 | } 44 | 45 | TEST_METHOD(uMatchTest2) 46 | { 47 | uMatchTest2Set(EssRxW::EngineOptions::F_ICASE); 48 | uMatchTest2Set(EssRxW::EngineOptions::F_ICASE | EssRxW::EngineOptions::F_MATCH_RESULT); 49 | } 50 | 51 | TEST_METHOD(uMatchTest3) 52 | { 53 | Assert::IsFalse(rxw.match(_T("number = '1271';"), _T("NUMBER = '????';"))); 54 | Assert::IsFalse(rxw.match(_T("number = 888;"), _T("NUMBER = +??;"))); 55 | 56 | Assert::IsFalse(rxw.match(_T("everything is ok"), _T("^everything*OK$"))); 57 | Assert::IsFalse(rxw.match(_T("systems"), _T("systeM?"))); 58 | Assert::IsFalse(rxw.match(_T("systems"), _T("sys###S"))); 59 | Assert::IsFalse(rxw.match(_T("A new 'X1' project"), _T("^a*'+' pro?ect"))); 60 | Assert::IsFalse(rxw.match(_T("professional system"), _T("pro*System"))); 61 | Assert::IsFalse(rxw.match(_T("regXwild in action"), _T("pro?ect$|open*source+act|^regxwild"))); 62 | } 63 | 64 | 65 | private: 66 | 67 | EssRxW rxw; 68 | 69 | }; 70 | } -------------------------------------------------------------------------------- /regXwildTest/EssSamplesTest.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "CppUnitTest.h" 3 | 4 | #include "..\regXwild\regXwild.h" 5 | 6 | using namespace Microsoft::VisualStudio::CppUnitTestFramework; 7 | using namespace net::r_eg::regXwild; 8 | 9 | namespace regXwildTest 10 | { 11 | TEST_CLASS(EssSamplesTest) 12 | { 13 | public: 14 | 15 | TEST_METHOD(sReadmeTest1) 16 | { 17 | Assert::IsTrue(rxw.match(_T("number = '1271';"), _T("number = '????';"))); 18 | Assert::IsTrue(rxw.match(_T("year = '2020';"), _T("'##'|'####'"))); 19 | Assert::IsTrue(rxw.match(_T("year = '20';"), _T("= '##??'"))); 20 | Assert::IsTrue(rxw.match(_T("number = 888;"), _T("number = +??;"))); 21 | 22 | // opposite data 23 | 24 | Assert::IsFalse(rxw.match(_T("number = '12710';"), _T("number = '????';"))); 25 | Assert::IsFalse(rxw.match(_T("year = '2020y';"), _T("'##'|'####'"))); 26 | Assert::IsFalse(rxw.match(_T("year = '20y';"), _T("= '##??'"))); 27 | Assert::IsFalse(rxw.match(_T("number = 8888;"), _T("number = +??;"))); 28 | } 29 | 30 | TEST_METHOD(sReadmeTest2) 31 | { 32 | Assert::IsTrue(rxw.match(_T("everything is ok"), _T("^everything*ok$"))); 33 | Assert::IsTrue(rxw.match(_T("systems"), _T("system?"))); 34 | Assert::IsTrue(rxw.match(_T("systems"), _T("sys###s"))); 35 | Assert::IsTrue(rxw.match(_T("A new 'X1' project"), _T("^A*'+' pro?ect"))); 36 | Assert::IsTrue(rxw.match(_T("professional system"), _T("pro*system"))); 37 | Assert::IsTrue(rxw.match(_T("regXwild in action"), _T("pro?ect$|open*source+act|^regXwild"))); 38 | 39 | // opposite data 40 | 41 | Assert::IsFalse(rxw.match(_T("everything is okay"), _T("^everything*ok$"))); 42 | Assert::IsTrue(rxw.match(_T("system"), _T("system?"))); 43 | Assert::IsFalse(rxw.match(_T("sys-tems"), _T("sys###s"))); 44 | Assert::IsTrue(rxw.match(_T("An amazing 'Y2' protect"), _T("^A*'+' pro?ect"))); 45 | Assert::IsTrue(rxw.match(_T("protecting system"), _T("pro*system"))); 46 | Assert::IsTrue(rxw.match(_T("opensource project regXwild in action"), _T("pro?ect$|open*source+act|^regXwild"))); 47 | } 48 | 49 | 50 | private: 51 | 52 | EssRxW rxw; 53 | 54 | }; 55 | } -------------------------------------------------------------------------------- /regXwildTest/EssSplitTest.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "CppUnitTest.h" 3 | 4 | #include "..\regXwild\regXwild.h" 5 | 6 | using namespace Microsoft::VisualStudio::CppUnitTestFramework; 7 | using namespace net::r_eg::regXwild; 8 | using namespace net::r_eg::regXwild::rxwtypes; 9 | 10 | namespace regXwildTest 11 | { 12 | TEST_CLASS(EssSplitTest) 13 | { 14 | public: 15 | 16 | TEST_METHOD(splitTest1) 17 | { 18 | tstring filter = _T("'##'|'####'"); 19 | 20 | Assert::IsTrue(rxw.match(_T("year = '2020';"), filter)); 21 | Assert::IsTrue(rxw.match(_T("year = '20';"), filter)); 22 | Assert::IsFalse(rxw.match(_T("year = '20y';"), filter)); 23 | Assert::IsFalse(rxw.match(_T("year = '2020y';"), filter)); 24 | Assert::IsFalse(rxw.match(_T("year = 2020;"), filter)); 25 | } 26 | 27 | TEST_METHOD(splitTest2) 28 | { 29 | tstring filter = _T("year = '####'|year = '##'"); 30 | 31 | Assert::IsTrue(rxw.match(_T("year = '2020';"), filter)); 32 | Assert::IsTrue(rxw.match(_T("year = '20';"), filter)); 33 | Assert::IsFalse(rxw.match(_T("year = '2020y';"), filter)); 34 | Assert::IsFalse(rxw.match(_T("year = 2020;"), filter)); 35 | } 36 | 37 | TEST_METHOD(splitTest3) 38 | { 39 | tstring filter = _T("str = '+++?'|str = '????'"); 40 | 41 | Assert::IsFalse(rxw.match(_T("str = '12345'"), filter)); 42 | Assert::IsTrue(rxw.match(_T("str = '1234'"), filter)); 43 | Assert::IsTrue(rxw.match(_T("str = '123'"), filter)); 44 | Assert::IsTrue(rxw.match(_T("str = '12'"), filter)); 45 | Assert::IsTrue(rxw.match(_T("str = '1'"), filter)); 46 | Assert::IsTrue(rxw.match(_T("str = ''"), filter)); 47 | } 48 | 49 | 50 | private: 51 | 52 | EssRxW rxw; 53 | 54 | }; 55 | } -------------------------------------------------------------------------------- /regXwildTest/regXwildTest.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | Debug 7 | Win32 8 | 9 | 10 | Release 11 | Win32 12 | 13 | 14 | Debug 15 | x64 16 | 17 | 18 | Release 19 | x64 20 | 21 | 22 | 23 | {B43C60C4-7B0D-466B-BE85-11298000062A} 24 | net::r_eg::regXwildTest 25 | v$(VisualStudioVersion.Replace(".", "")) 26 | v141 27 | v142 28 | $(LatestTargetPlatformVersion) 29 | 10.0 30 | 31 | 32 | 33 | DynamicLibrary 34 | true 35 | false 36 | 37 | 38 | DynamicLibrary 39 | false 40 | true 41 | false 42 | 43 | 44 | DynamicLibrary 45 | true 46 | false 47 | 48 | 49 | DynamicLibrary 50 | false 51 | true 52 | false 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | true 74 | $(ProjectDir);$(IncludePath) 75 | 76 | 77 | true 78 | $(ProjectDir);$(IncludePath) 79 | 80 | 81 | false 82 | $(ProjectDir);$(IncludePath) 83 | 84 | 85 | false 86 | $(ProjectDir);$(IncludePath) 87 | 88 | 89 | 90 | Use 91 | Level3 92 | Disabled 93 | $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) 94 | WIN32;_DEBUG;%(PreprocessorDefinitions) 95 | true 96 | 97 | 98 | Windows 99 | $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) 100 | 101 | 102 | 103 | 104 | Use 105 | Level3 106 | Disabled 107 | $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) 108 | _DEBUG;%(PreprocessorDefinitions) 109 | true 110 | 111 | 112 | Windows 113 | $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) 114 | 115 | 116 | 117 | 118 | Level3 119 | Use 120 | MaxSpeed 121 | true 122 | true 123 | $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) 124 | WIN32;NDEBUG;%(PreprocessorDefinitions) 125 | true 126 | 127 | 128 | Windows 129 | true 130 | true 131 | $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) 132 | 133 | 134 | 135 | 136 | Level3 137 | Use 138 | MaxSpeed 139 | true 140 | true 141 | $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) 142 | NDEBUG;%(PreprocessorDefinitions) 143 | true 144 | 145 | 146 | Windows 147 | true 148 | true 149 | $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | Create 167 | Create 168 | Create 169 | Create 170 | 171 | 172 | 173 | 174 | 175 | {74660324-42aa-41b6-9fdb-e0ed0d0144ce} 176 | 177 | 178 | 179 | 180 | 181 | -------------------------------------------------------------------------------- /regXwildTest/regXwildTest.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | 26 | 27 | Source Files 28 | 29 | 30 | Source Files 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | Source Files 43 | 44 | 45 | Source Files 46 | 47 | 48 | Source Files 49 | 50 | 51 | Source Files 52 | 53 | 54 | Source Files 55 | 56 | 57 | -------------------------------------------------------------------------------- /regXwildTest/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // regXwildTest.pch will be the pre-compiled header 2 | // stdafx.obj will contain the pre-compiled type information 3 | 4 | #include "stdafx.h" -------------------------------------------------------------------------------- /regXwildTest/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "targetver.h" 4 | 5 | // Headers for CppUnitTest 6 | #include "CppUnitTest.h" 7 | -------------------------------------------------------------------------------- /regXwildTest/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /snet/Algorithms.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text.RegularExpressions; 3 | using net.r_eg.Conari; 4 | using net.r_eg.Conari.Types; 5 | 6 | namespace snet 7 | { 8 | internal class Algorithms 9 | { 10 | protected Regex filter; 11 | 12 | public bool regXwildEssLambda(WCharPtr data, WCharPtr filter, IConari l) 13 | { 14 | return l.bind>("searchEssC")(data, filter, true); 15 | } 16 | 17 | public bool regXwildEssDLR(WCharPtr data, WCharPtr filter, IConari l) 18 | { 19 | return l.DLR.searchEssC(data, filter, true); 20 | } 21 | 22 | public bool regXwildExtLambda(WCharPtr data, WCharPtr filter, IConari l) 23 | { 24 | return l.bind>("searchExtC")(data, filter, true); 25 | } 26 | 27 | public bool regXwildExtDLR(WCharPtr data, WCharPtr filter, IConari l) 28 | { 29 | return l.DLR.searchExtC(data, filter, true); 30 | } 31 | 32 | public bool regexMatch(ref string data) 33 | { 34 | return filter.IsMatch(data); 35 | } 36 | 37 | public void regexInitFilter(string filter, bool compiled) 38 | { 39 | RegexOptions flags = RegexOptions.IgnoreCase; 40 | if(compiled) { 41 | flags |= RegexOptions.Compiled; 42 | } 43 | 44 | this.filter = new Regex(filter, flags); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /snet/Analyzer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using net.r_eg.Conari; 3 | using net.r_eg.Conari.Types; 4 | 5 | namespace snet 6 | { 7 | internal class Analyzer 8 | { 9 | protected int iterations; 10 | protected int average; 11 | 12 | public Analyzer(int iterations = 10000, int average = 4) 13 | { 14 | this.iterations = iterations; 15 | this.average = average; 16 | } 17 | 18 | public void Calc() 19 | { 20 | string data = "#//Anime/Kyoto Animation/Clannad TV -/Suzumiya Haruhi/Lucky Star/Full Metal Panic Fumoffu/P.A. Works/Angel Beats!/A-1 Pictures/Ano Hi Mita Hana no Namae wo Bokutachi wa Mada Shira nai/Макото Синкай [2002] Kanojo to kanojo no neko/ Kino no Tabi @ ... World/White Fox/Врата Штайнера (Врата Штейна (Steins Gate))/SHAFT/Maho Shojo Madoka Magica"; //340 21 | string filter = "nime**haru*02*Magica"; 22 | 23 | tryAlgo(data, filter); 24 | 25 | Console.WriteLine(Environment.NewLine); 26 | 27 | tryRegex(data, filter.Replace("*", ".*")); 28 | } 29 | 30 | public void tryAlgo(string data, string filter) 31 | { 32 | using(IConari l = new ConariL("regXwild.dll")) 33 | { 34 | Console.Write($"regXwild module: "); 35 | 36 | #if RXW_UNICODE 37 | UnmanagedString.SType sType = UnmanagedString.SType.Unicode; 38 | Console.WriteLine($"Unicode"); 39 | #else 40 | UnmanagedString.SType sType = UnmanagedString.SType.Ansi; 41 | Console.WriteLine($"MultiByte"); 42 | #endif 43 | 44 | using(var uData = new UnmanagedString(data, sType)) 45 | using(var uFilter = new UnmanagedString(filter, sType)) 46 | { 47 | Console.WriteLine($"\niterations({iterations}) x average({average})\n"); 48 | 49 | var alg = new Algorithms(); 50 | 51 | calcAlgo(" regXwild via Conari (Lambda) - ESS version: ", l, uData, uFilter, alg.regXwildEssLambda); 52 | calcAlgo(" regXwild via Conari (DLR)- ESS version: ", l, uData, uFilter, alg.regXwildEssDLR); 53 | calcAlgo(" regXwild via Conari (Lambda) - EXT version: ", l, uData, uFilter, alg.regXwildExtLambda); 54 | calcAlgo(" regXwild via Conari (DLR) - EXT version: ", l, uData, uFilter, alg.regXwildExtDLR); 55 | } 56 | } 57 | } 58 | 59 | public void calcAlgo(string label, IConari l, WCharPtr data, WCharPtr filter, Func method) 60 | { 61 | var meter = new Meter(); 62 | 63 | double results = 0; 64 | 65 | meter.start(); 66 | 67 | results += meter.delta(); 68 | 69 | for(int total = 0; total < average; ++total) 70 | { 71 | meter.start(); 72 | for(int i = 0; i < iterations; ++i) { 73 | if(method(data, filter, l)) { 74 | 75 | } 76 | } 77 | results += meter.delta(); 78 | Console.Write("."); 79 | } 80 | 81 | Console.WriteLine($"{label}{ms(results / average)}"); 82 | } 83 | 84 | protected void tryRegex(string data, string filter) 85 | { 86 | tryRegex(true, data, filter); 87 | Console.WriteLine("\n-------\n"); 88 | tryRegex(false, data, filter); 89 | } 90 | 91 | protected void tryRegex(bool compile, string data, string filter) 92 | { 93 | Console.WriteLine($".NET Regex. Compile: {compile} \niterations({iterations}) x average({average})\n"); 94 | Console.WriteLine("Please wait for the result ...\n\n"); 95 | 96 | calcRegex(compile, " .NET Regex engine: ", data, filter); 97 | calcRegex(compile, " .NET Regex engine(only as ^match$ like a simple '=='): ", data, "^" + filter + "$"); 98 | } 99 | 100 | protected void calcRegex(bool compiled, string label, string data, string filter) 101 | { 102 | var alg = new Algorithms(); 103 | var meter = new Meter(); 104 | 105 | double results = 0; 106 | 107 | meter.start(); 108 | 109 | alg.regexInitFilter(filter, compiled); 110 | 111 | results += meter.delta(); 112 | 113 | for(int total = 0; total < average; ++total) 114 | { 115 | meter.start(); 116 | for(int i = 0; i < iterations; ++i) { 117 | if(alg.regexMatch(ref data)) { 118 | 119 | } 120 | } 121 | results += meter.delta(); 122 | Console.Write("."); 123 | } 124 | 125 | Console.WriteLine($"{label}{ms(results / average)}"); 126 | } 127 | 128 | private string ms(double val) 129 | { 130 | return (val < 1) ? "< 1ms" : $"~{(int)val}ms"; 131 | } 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /snet/Meter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace snet 4 | { 5 | internal class Meter 6 | { 7 | private DateTime started; 8 | 9 | public void start() 10 | { 11 | started = DateTime.Now; 12 | } 13 | 14 | public double delta() 15 | { 16 | return (DateTime.Now - started).TotalMilliseconds; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /snet/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using net.r_eg.Conari; 3 | 4 | namespace snet 5 | { 6 | class Program 7 | { 8 | static void Main(string[] args) 9 | { 10 | Console.WriteLine("\n https://github.com/3F/regXwild \n"); 11 | 12 | Console.WriteLine(".NET version via Conari engine - github.com/3F/Conari"); 13 | Console.WriteLine($"Used Conari version: {ConariVersion.S_NUM_REV}+{ConariVersion.BRANCH_SHA1}\n"); 14 | #if DEBUG 15 | Console.WriteLine("\nPlease compile it first for the `Release` configuration.\n\n"); 16 | 17 | #else 18 | 19 | Analyzer anl = new Analyzer(); 20 | anl.Calc(); 21 | 22 | Console.WriteLine("\nDone."); 23 | 24 | #endif 25 | Console.ReadKey(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /snet/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("snet")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("snet")] 13 | [assembly: AssemblyCopyright("")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("12b25935-229f-4128-b66b-7561a77abc54")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /snet/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /snet/snet.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | Debug 7 | x86 8 | {12B25935-229F-4128-B66B-7561A77ABC54} 9 | Exe 10 | Properties 11 | snet 12 | snet 13 | v4.0 14 | 512 15 | IDE1006 16 | 17 | 18 | true 19 | DEBUG;TRACE 20 | full 21 | x64 22 | prompt 23 | MinimumRecommendedRules.ruleset 24 | 25 | 26 | TRACE 27 | true 28 | pdbonly 29 | x64 30 | prompt 31 | MinimumRecommendedRules.ruleset 32 | 33 | 34 | true 35 | DEBUG;TRACE 36 | full 37 | x86 38 | prompt 39 | MinimumRecommendedRules.ruleset 40 | 41 | 42 | TRACE 43 | true 44 | pdbonly 45 | x86 46 | prompt 47 | MinimumRecommendedRules.ruleset 48 | 49 | 50 | 51 | ..\packages\Conari.1.4.0\lib\net40\Conari.dll 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /tools/gnt.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | :: GetNuTool - Executable version 3 | :: Copyright (c) 2015-2018,2020 Denis Kuzmin [ x-3F@outlook.com ] 4 | :: https://github.com/3F/GetNuTool 5 | set aa=gnt.core 6 | set ab="%temp%\%random%%random%%aa%" 7 | if "%~1"=="-unpack" goto ag 8 | set ac=%* 9 | if defined __p_call if defined ac set ac=%ac:^^=^% 10 | set ad=%__p_msb% 11 | if defined ad goto ah 12 | if "%~1"=="-msbuild" goto ai 13 | for %%v in (4.0, 14.0, 12.0, 3.5, 2.0) do ( 14 | for /F "usebackq tokens=2* skip=2" %%a in ( 15 | `reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\%%v" /v MSBuildToolsPath 2^> nul` 16 | ) do if exist %%b ( 17 | set ad="%%~b\MSBuild.exe" 18 | goto ah 19 | ) 20 | ) 21 | echo MSBuild was not found. Try -msbuild "fullpath" args 1>&2 22 | exit/B 2 23 | :ai 24 | shift 25 | set ad=%1 26 | shift 27 | set ae=%ac:!= #__b_ECL## % 28 | setlocal enableDelayedExpansion 29 | set ae=!ae:%%=%%%%! 30 | :aj 31 | for /F "tokens=1* delims==" %%a in ("!ae!") do ( 32 | if "%%~b"=="" ( 33 | call :ak !ae! 34 | exit/B %ERRORLEVEL% 35 | ) 36 | set ae=%%a #__b_EQ## %%b 37 | ) 38 | goto aj 39 | :ak 40 | shift & shift 41 | set "ac=" 42 | :al 43 | set ac=!ac! %1 44 | shift & if not "%~2"=="" goto al 45 | set ac=!ac: #__b_EQ## ==! 46 | setlocal disableDelayedExpansion 47 | set ac=%ac: #__b_ECL## =!% 48 | :ah 49 | call :am 50 | call %ad% %ab% /nologo /p:wpath="%cd%/" /v:m /m:4 %ac% 51 | set "ad=" 52 | set af=%ERRORLEVEL% 53 | del /Q/F %ab% 54 | exit/B %af% 55 | :ag 56 | set ab="%cd%\%aa%" 57 | echo Generating minified version in %ab% ... 58 | :am 59 | %ab% 60 | set a=PropertyGroup&set b=Condition&set c=ngpackages&set d=Target&set e=DependsOnTargets&set f=TaskCoreDllPath&set g=MSBuildToolsPath&set h=UsingTask&set i=CodeTaskFactory&set j=ParameterGroup&set k=Reference&set l=Include&set m=System&set n=Using&set o=Namespace&set p=IsNullOrEmpty&set q=return&set r=string&set s=delegate&set t=foreach&set u=WriteLine&set v=Combine&set w=Console.WriteLine&set x=Directory&set y=GetNuTool&set z=StringComparison&set _=EXT_NUSPEC 61 | ^ 5 | 6 | 7 | $(MSBuildThisFileDirectory)..\..\ 8 | $(regXwildRootPkg)lib\native\ 9 | MultiByte 10 | $(DefineConstants);RXW_UNICODE 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /tools/regXwild.native.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | $(MSBuildThisFileDirectory)..\..\ 8 | $(regXwildRootPkg)lib\native\$(Platform)-$(CharacterSet)\ 9 | $(PathToBin_regXwild)include\;$(IncludePath) 10 | $(PathToBin_regXwild);$(LibraryPath) 11 | 12 | 13 | 14 | REGXWILD_AS_LIB;%(PreprocessorDefinitions) 15 | 4480;4482;%(DisableSpecificWarnings) 16 | 17 | 18 | regXwild.lib;%(AdditionalDependencies) 19 | 20 | 21 | 22 | 23 | RXW_UNICODE;%(PreprocessorDefinitions) 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /tools/regXwild.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | regXwild 5 | $-version-$ 6 | [ regXwild ] Fast Advanced wildcards 7 | github.com/3F/regXwild 8 | LICENSE 9 | reg 10 | https://aka.ms/deprecateLicenseUrl 11 | https://github.com/3F/regXwild 12 | 13 | false 14 | ⏱ Superfast ^Advanced wildcards++? `*,|,?,^,$,+,#,>,++??,##??,>c` ... 15 | 16 | Unique algorithms that was implemented on native unmanaged C++ but easily accessible in .NET 17 | through Conari (recommended due to caching of 0x29 opcodes + related optimizations) etc. 18 | 19 | ✔ regex-like quantifiers and amazing meta symbols 20 | 21 | Samples [⏯] 22 | 23 | number = '1271'; ⬅ number = '????'; ⬅ [0 - 4] 24 | year = '2020'; ⬅ '##'|'####' ⬅ [2; 4] 25 | year = '20'; ⬅ = '##??' ⬅ [2; 4] 26 | number = 888; ⬅ number = +??; ⬅ [1 - 3] 27 | ... 28 | everything is ok ⬅ ^everything*ok$ 29 | systems ⬅ system? 30 | systems ⬅ sys###s 31 | A new 'X1' project ⬅ ^A*'+' pro?ect 32 | professional system ⬅ pro*system 33 | regXwild in action ⬅ pro?ect$|open*source+act|^regXwild 34 | 35 | 36 | This package contains x64 + x32 Unicode + MultiByte modules 37 | and provides both support of the unmanaged and managed projects: 38 | 39 | * For native: .\lib\native\{Platform}-(Unicode or MultiByte)\ ~ regXwild.dll, regXwild.lib, regXwild.exp, include\*.h 40 | * For .NET it will put x32 & x64 regXwild into (TargetDir). Use it with your .net modules through Conari ( https://github.com/3F/Conari ) and so on. 41 | 42 | ... 43 | MIT License 44 | 45 | https://github.com/3F/regXwild 46 | - - - - - - - - - - - - - - - - 47 | 48 | ======================================= 49 | gnt /p:ngpackages="regXwild/$-version-$" 50 | ================== https://github.com/3F/GetNuTool 51 | 52 | {build-info} 53 | Small and super Fast advanced wildcards! `*,|,?,^,$,+,#,>,++??,##??` in addition to slow regex engines and... https://github.com/3F/regXwild 54 | wildcards advanced-wildcards fast-wildcards fast-regex extended-wildcards strings text filter search matching search-in-text regex glob filters powerful-wildcards regexp cpp c dotnet dotnetcore csharp Conari regXwild native 55 | changelog: https://github.com/3F/regXwild/blob/master/changelog.txt 56 | Copyright (c) 2013-2021 Denis Kuzmin <x-3F@outlook.com> github/3F 57 | 58 | --------------------------------------------------------------------------------