Comments (7)
See changes to modTests.TestRegex2 method for a demonstration as per commit 66c88a1
from vbpcre2.
Strange, that PCRE2 produces in fact only one significant result: File1.zip.exe instead of three.
However, I think such .*$
regexp is incorrect at all. It is the same like (about)?
regexp. Mean: you are trying to find empty string (as one of true results). If you enter such regexp e.g. on some online java regexp tester it will produce error
, mean that regexp should not allow an empty strings as one of the true results of execution.
From this point of view, difference in results between VBS/PCRE2 is only a matter of its internal error handler mechanism which has different realization.
So, in real .+$
shoud be used instead of .*$
.
As a conclusion, personally I believe that it is not necessary to touch such behavior. Anyway, if I would change something, I would detect regexp string that allow empty result and replace result string with raising error.
from vbpcre2.
Although, if VBS already produces the most complete result, I still would not have refused if PCRE2 would produces the same result to support strategy of PCRE2 as analogue of VBS.Regexp
to show at least these 3 lines for .*$
- File1.zip.exe
- File2.com
- File 3
But I don't khow, how you can track such cases and not break anything else.
from vbpcre2.
Yeah it's a bit of a weird one - interesting that some online regexp sites produce an error, but PCRE2 and VBScript produce results (albeit different). Makes it hard to know what the best approach is.
It might be that there is a PCRE2 option flag to handle this situation, I'll ahve to look at them all more closely (or maybe it's just up to my Global matching loop to work a bit differently to produce the same results as VBScript).
I don't have time to look closer right now, but I will try soon.
from vbpcre2.
According to my tests, no option pre-defined in your class allow to change behavior, except:
- Dollar Matches End of string Only
- Dot matches All Characters
which affect all text falls into first substring, like:
Match Count: 2
#1: File1.zip.exe
File2.com
File 3
Sub.#1:
#2:
Sub.#2:
from vbpcre2.
Who is right?
Both results are correct. The wrong here is your expectation.
Multiline = True
in VBScript's RegExp simply means ^$ match at line breaks
which is an option that must explicitly set (as you did in VBScript) for PCRE, namely PCRE2_MULTILINE
.
So it seems OK, you just changed the default behavior for VBScript but not for PCRE in your test.
from vbpcre2.
Oh, I forgot to mention. I've never used your wrapper.
If you're sure that the PCRE2_MULTILINE
flag is set in your wrapper that means a problem of your wrapper or PCRE. VBScript's RegExp works as it should in this case.
from vbpcre2.
Related Issues (20)
- Move all PCRE2 constants into enums in modPcre HOT 2
- Pointer problem with pcre2_set_callout HOT 2
- Object and Method Names Should More Closely Match PCRE2 Names HOT 2
- Correction to code comments HOT 1
- Feature: FirstIndex of CPcreMatch HOT 2
- Variable names prefixes HOT 2
- Brackets [] in enum HOT 2
- Unused variables HOT 1
- Memory overflow with regular .* HOT 4
- Error checking in SubMatchValue() HOT 1
- Infinite loop in 'Replace' of empty line HOT 1
- Create ActiveX DLL Using PCRE2 Classes HOT 3
- Documentation Needed HOT 1
- Bad Submatch Handling Discovered HOT 1
- Pre-built VBPCRE2Test.exe in /bin folder is out-of-date HOT 3
- New pcre2 release - should we rebuild against it? HOT 16
- Should/can we statically link pcre-16.dll and VBPCRE2.dll? HOT 4
- i have compile the latest pcre2.dll and i want to make vbPCRE2.dll to be fullly compapible with vbscript HOT 1
- Office 365 64-bit. "Class not Registered" HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vbpcre2.